diff options
author | Alessandro Portale <alessandro.portale@nokia.com> | 2010-06-22 17:01:39 (GMT) |
---|---|---|
committer | Alessandro Portale <alessandro.portale@nokia.com> | 2010-06-22 17:01:39 (GMT) |
commit | 32a798150ab3393d366626d9f58eddb3ae83f788 (patch) | |
tree | 1ac871378aee6532c8006057f562d56a2189cadc /src | |
parent | 2e29f107476428bba4aad5c2d56a2a19921931dc (diff) | |
download | Qt-32a798150ab3393d366626d9f58eddb3ae83f788.zip Qt-32a798150ab3393d366626d9f58eddb3ae83f788.tar.gz Qt-32a798150ab3393d366626d9f58eddb3ae83f788.tar.bz2 |
Fix a crash on exit. Destruction order in font database. (Symbian^4)
The implementation for the QT_2746 task had a wrong destruction order
of font database elements. The 'QSymbianTypeFaceExtras' in Symbian^4
hold a CFont which is retrieved from the Symbian ScreenDevice. They
have to be released by the same ScreenDevice. The error was that
the release was attempted after the connection to the ScreenDevice
was closed.
This fix causes an earlier destruction of all 'QSymbianTypeFaceExtras'
and the removal of their their CFonts in qt_cleanup. While the
connection to the ScreenDevice is still alive.
Task-number: QT_2746
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 3 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_s60.cpp | 21 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index d5d4be6..a7c7310 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1441,6 +1441,8 @@ void qt_init(QApplicationPrivate * /* priv */, int) qRegisterMetaType<WId>("WId"); } +extern void qt_cleanup_symbianFontDatabaseExtras(); // qfontdatabase_s60.cpp + /***************************************************************************** qt_cleanup() - cleans up when the application is finished *****************************************************************************/ @@ -1451,6 +1453,7 @@ void qt_cleanup() qt_S60Beep = 0; } QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles + qt_cleanup_symbianFontDatabaseExtras(); // S60 structure and window server session are freed in eventdispatcher destructor as they are needed there // It's important that this happens here, before the event dispatcher gets diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index cdfba3d..5148568 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -122,7 +122,6 @@ public: } }; -private: #ifndef Q_SYMBIAN_HAS_FONTTABLE_API RHeap* m_heap; CFontStore *m_store; @@ -159,20 +158,30 @@ QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementati #endif // !Q_SYMBIAN_HAS_FONTTABLE_API } -QSymbianFontDatabaseExtrasImplementation::~QSymbianFontDatabaseExtrasImplementation() +void qt_cleanup_symbianFontDatabaseExtras() { + const QSymbianFontDatabaseExtrasImplementation *dbExtras = + static_cast<const QSymbianFontDatabaseExtrasImplementation*>(privateDb()->symbianExtras); #ifdef Q_SYMBIAN_HAS_FONTTABLE_API - qDeleteAll(m_extrasHash); + qDeleteAll(dbExtras->m_extrasHash); #else // Q_SYMBIAN_HAS_FONTTABLE_API typedef QList<const QSymbianTypeFaceExtras *>::iterator iterator; - for (iterator p = m_extras.begin(); p != m_extras.end(); ++p) { - m_store->ReleaseFont((*p)->fontOwner()); + for (iterator p = dbExtras->m_extras.begin(); p != dbExtras->m_extras.end(); ++p) { + dbExtras->m_store->ReleaseFont((*p)->fontOwner()); delete *p; } + dbExtras->m_extras.clear(); +#endif // Q_SYMBIAN_HAS_FONTTABLE_API + dbExtras->m_extrasHash.clear(); +} +QSymbianFontDatabaseExtrasImplementation::~QSymbianFontDatabaseExtrasImplementation() +{ + qt_cleanup_symbianFontDatabaseExtras(); +#ifndef Q_SYMBIAN_HAS_FONTTABLE_API delete m_store; m_heap->Close(); -#endif // Q_SYMBIAN_HAS_FONTTABLE_API +#endif // !Q_SYMBIAN_HAS_FONTTABLE_API } #ifndef FNTSTORE_H_INLINES_SUPPORT_FMM |