Commit 3b7164b3188e9382510bef2211e82ef777faa75c
Fixed casual crash in initializeDb (Symbian)
dynamic_cast should be used carefully with rvct before version 4.
We found that out after the a dynamic (down)-cast from CFont* to
CFbsFont* in QtGui suddenly failed.
We test for (TypeUid() == KCFbsFontUid), before doing the
cast. So, a static_cast is safe in this case. Also the other
two dynamic_casts in qfontdatabase_s60.cpp were changed to
static_cast.
http://bugreports.qt.nokia.com/browse/QTBUG-7963
Task-number: QTBUG-7963
Reviewed-by: lars
modified: src/gui/text/qfontdatabase_s60.cpp
| |   |
| 246 | 246 | QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); |
| 247 | 247 | |
| 248 | 248 | const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces(); |
| const QFontDatabaseS60StoreImplementation *store = dynamic_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store); |
| Q_ASSERT(store); |
| const QFontDatabaseS60StoreImplementation *store = |
| static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store); |
| 251 | 251 | bool fontAdded = false; |
| 252 | 252 | for (int i = 0; i < numTypeFaces; i++) { |
| 253 | 253 | TTypefaceSupport typefaceSupport; |
| … | … | |
| 258 | 258 | continue; |
| 259 | 259 | if (font->TypeUid() == KCFbsFontUid) { |
| 260 | 260 | TOpenFontFaceAttrib faceAttrib; |
| const CFbsFont *cfbsFont = dynamic_cast<const CFbsFont *>(font); |
| Q_ASSERT(cfbsFont); |
| const CFbsFont *cfbsFont = static_cast<const CFbsFont *>(font); |
| 263 | 262 | cfbsFont->GetFaceAttrib(faceAttrib); |
| 264 | 263 | |
| 265 | 264 | QtFontStyle::Key styleKey; |
| … | … | |
| 389 | 389 | QFontDef request = req; |
| 390 | 390 | request.family = fontFamily; |
| 391 | 391 | #if defined(QT_NO_FREETYPE) |
| const QFontDatabaseS60StoreImplementation *store = dynamic_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store); |
| Q_ASSERT(store); |
| const QFontDatabaseS60StoreImplementation *store = |
| static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store); |
| 394 | 394 | const QFontEngineS60Extensions *extension = store->extension(fontFamily); |
| 395 | 395 | fe = new QFontEngineS60(request, extension); |
| 396 | 396 | #else |