summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@nokia.com>2010-02-05 20:31:10 (GMT)
committerAlessandro Portale <alessandro.portale@nokia.com>2010-02-05 20:31:10 (GMT)
commit3b7164b3188e9382510bef2211e82ef777faa75c (patch)
tree708c3c327a7467a292ed37702efdee6c8cb1486e /src/gui
parent1a4669544e501b612ef277b614246c0586e44e2b (diff)
downloadQt-3b7164b3188e9382510bef2211e82ef777faa75c.zip
Qt-3b7164b3188e9382510bef2211e82ef777faa75c.tar.gz
Qt-3b7164b3188e9382510bef2211e82ef777faa75c.tar.bz2
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
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp11
1 files 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<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
- Q_ASSERT(store);
+ const QFontDatabaseS60StoreImplementation *store =
+ static_cast<const QFontDatabaseS60StoreImplementation*>(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<const CFbsFont *>(font);
- Q_ASSERT(cfbsFont);
+ const CFbsFont *cfbsFont = static_cast<const CFbsFont *>(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<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
- Q_ASSERT(store);
+ const QFontDatabaseS60StoreImplementation *store =
+ static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
const QFontEngineS60Extensions *extension = store->extension(fontFamily);
fe = new QFontEngineS60(request, extension);
#else