diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-09-13 20:57:55 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-09-13 20:57:55 (GMT) |
commit | b891d591505728a6e37dc877c8e08d826504100a (patch) | |
tree | f7390a39be4aba1bdc8cfcb24193f8800c30b69f | |
parent | b2b6d0927dd3f7b4ea0fbfca27d1bb4c2a0e246b (diff) | |
parent | acfa2011d2d472f029d30286a36586e16b9bade8 (diff) | |
download | Qt-b891d591505728a6e37dc877c8e08d826504100a.zip Qt-b891d591505728a6e37dc877c8e08d826504100a.tar.gz Qt-b891d591505728a6e37dc877c8e08d826504100a.tar.bz2 |
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-symbian-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-symbian-team:
Fix panic when global QSettings instance needs flusing at app exit
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 18a5eae..752bbaa 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -273,6 +273,29 @@ bool QCoreApplicationPrivate::is_app_closing = false; // initialized in qcoreapplication and in qtextstream autotest when setlocale is called. Q_CORE_EXPORT bool qt_locale_initialized = false; +#ifdef Q_OS_SYMBIAN +// The global QSettings needs to be cleaned where cleanup stack is available, which is not +// normally the case when global static destructors are run. +// Declare a custom QGlobalStaticDeleter for QSettings to handle that case. +template<> +class QGlobalStaticDeleter<QSettings> +{ +public: + QGlobalStatic<QSettings> &globalStatic; + QGlobalStaticDeleter(QGlobalStatic<QSettings> &_globalStatic) + : globalStatic(_globalStatic) + { } + + inline ~QGlobalStaticDeleter() + { + CTrapCleanup *cleanup = CTrapCleanup::New(); + delete globalStatic.pointer; + delete cleanup; + globalStatic.pointer = 0; + globalStatic.destroyed = true; + } +}; +#endif /* Create an instance of Trolltech.conf. This ensures that the settings will not |