diff options
author | mae <qt-info@nokia.com> | 2011-04-29 09:44:43 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2011-04-29 09:44:43 (GMT) |
commit | 31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5 (patch) | |
tree | 15e8c0132ac06a9614d69e909c233ef811f17aa2 /src/corelib/kernel/qcoreapplication.cpp | |
parent | c85c1ea36cd9ebe6a9ff970d7ba0ce8d08d5b27b (diff) | |
download | Qt-31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5.zip Qt-31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5.tar.gz Qt-31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5.tar.bz2 |
Reduce open and stat system calls for QSettings
The patch moves the global static QSettings object
from QLibrary to QCoreApplication and reduces a
few stat and open calls.
Without the patch, a large Trolltech.conf was
pushed out of the unused settings cache during
startup, meaning Trolltech.conf was parsed
more than once.
Reviewed-by: Liang Qi
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index be86c58..df8bc59 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -270,6 +270,8 @@ bool QCoreApplicationPrivate::is_app_closing = false; Q_CORE_EXPORT bool qt_locale_initialized = false; +QSettings *QCoreApplicationPrivate::trolltechConf = 0; + Q_CORE_EXPORT uint qGlobalPostedEventsCount() { QThreadData *currentThreadData = QThreadData::current(); @@ -371,6 +373,9 @@ QCoreApplicationPrivate::~QCoreApplicationPrivate() threadData->postEventList.recursion = 0; threadData->quitNow = false; } + + delete trolltechConf; + trolltechConf = 0; } void QCoreApplicationPrivate::createEventDispatcher() @@ -688,6 +693,13 @@ 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(); } |