From 42452a32bfea29bf8176d19442f6e3c890c2b7e2 Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 2 May 2011 11:56:03 +0200 Subject: Fix regression with QSettings patch The plugin loader is used without QCoreApplication. This fixes 31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5 (cherry picked from commit 988871dabf3c949ffc71d126131281a3ae641ebf) --- src/corelib/kernel/qcoreapplication.cpp | 21 ++++++++++----------- src/corelib/kernel/qcoreapplication_p.h | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 2eef70a480..afbcff3eb9 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -270,7 +270,16 @@ bool QCoreApplicationPrivate::is_app_closing = false; Q_CORE_EXPORT bool qt_locale_initialized = false; -QSettings *QCoreApplicationPrivate::trolltechConf = 0; +/* + Create an instance of Trolltech.conf. This ensures that the settings will not + be thrown out of QSetting's cache for unused settings. + */ +Q_GLOBAL_STATIC_WITH_ARGS(QSettings, trolltechConf, (QSettings::UserScope, QLatin1String("Trolltech"))) + +QSettings *QCoreApplicationPrivate::trolltechConf() +{ + return ::trolltechConf(); +} Q_CORE_EXPORT uint qGlobalPostedEventsCount() { @@ -373,9 +382,6 @@ QCoreApplicationPrivate::~QCoreApplicationPrivate() threadData->postEventList.recursion = 0; threadData->quitNow = false; } - - delete trolltechConf; - trolltechConf = 0; } void QCoreApplicationPrivate::createEventDispatcher() @@ -697,13 +703,6 @@ void QCoreApplication::init() } #endif - - /* - Create an instance of Trolltech.conf. This ensures that the settings will not - be thrown out of QSetting's cache for unused settings. - */ - d->trolltechConf = new QSettings(QSettings::UserScope, QLatin1String("Trolltech")); - qt_startup_hook(); } diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 937a101085..5079e4681c 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -142,7 +142,7 @@ public: #if defined(QT3_SUPPORT) static bool useQt3Support; #endif - static QSettings *trolltechConf; + static QSettings *trolltechConf(); }; QT_END_NAMESPACE -- cgit v1.2.3