From 4b75ceea08815c096ec35a077c5c1e3bfca0e5ed Mon Sep 17 00:00:00 2001 From: mae Date: Fri, 29 Apr 2011 11:44:43 +0200 Subject: 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 (cherry picked from commit 31ef8fa6abc2ea23c6f0a996b36494d88aafb0b5) --- src/corelib/plugin/qlibrary.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/corelib/plugin/qlibrary.cpp') diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 80e927bcc9..6f3ee1c3d3 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #ifdef Q_OS_MAC # include #endif @@ -408,12 +409,6 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB typedef QMap LibraryMap; struct LibraryData { - LibraryData() : settings(0) { } - ~LibraryData() { - delete settings; - } - - QSettings *settings; LibraryMap libraryMap; QSet loadedLibs; }; @@ -711,11 +706,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) QStringList reg; #ifndef QT_NO_SETTINGS if (!settings) { - settings = libraryData()->settings; - if (!settings) { - settings = new QSettings(QSettings::UserScope, QLatin1String("Trolltech")); - libraryData()->settings = settings; - } + settings = QCoreApplicationPrivate::trolltechConf; } reg = settings->value(regkey).toStringList(); #endif -- cgit v1.2.3 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/plugin/qlibrary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/plugin/qlibrary.cpp') diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 6f3ee1c3d3..d9aac00cf1 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -706,7 +706,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) QStringList reg; #ifndef QT_NO_SETTINGS if (!settings) { - settings = QCoreApplicationPrivate::trolltechConf; + settings = QCoreApplicationPrivate::trolltechConf(); } reg = settings->value(regkey).toStringList(); #endif -- cgit v1.2.3