From 3b7164b3188e9382510bef2211e82ef777faa75c Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 5 Feb 2010 21:31:10 +0100 Subject: 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 --- src/gui/text/qfontdatabase_s60.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index f8de08f..7e5397d 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -246,8 +246,8 @@ static void initializeDb() QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces(); - const QFontDatabaseS60StoreImplementation *store = dynamic_cast(db->s60Store); - Q_ASSERT(store); + const QFontDatabaseS60StoreImplementation *store = + static_cast(db->s60Store); bool fontAdded = false; for (int i = 0; i < numTypeFaces; i++) { TTypefaceSupport typefaceSupport; @@ -258,8 +258,7 @@ static void initializeDb() continue; if (font->TypeUid() == KCFbsFontUid) { TOpenFontFaceAttrib faceAttrib; - const CFbsFont *cfbsFont = dynamic_cast(font); - Q_ASSERT(cfbsFont); + const CFbsFont *cfbsFont = static_cast(font); cfbsFont->GetFaceAttrib(faceAttrib); QtFontStyle::Key styleKey; @@ -390,8 +389,8 @@ QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFo QFontDef request = req; request.family = fontFamily; #if defined(QT_NO_FREETYPE) - const QFontDatabaseS60StoreImplementation *store = dynamic_cast(db->s60Store); - Q_ASSERT(store); + const QFontDatabaseS60StoreImplementation *store = + static_cast(db->s60Store); const QFontEngineS60Extensions *extension = store->extension(fontFamily); fe = new QFontEngineS60(request, extension); #else -- cgit v0.12