summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qsettings.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-01-28 10:22:04 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-01-28 10:22:04 (GMT)
commit2a82051815a3c8bb8fbb2b58dff5653c80d6fa33 (patch)
tree532af77f7fc288e5992b4a0ba52a008f1598a8c6 /src/corelib/io/qsettings.cpp
parent280f1f7bfc1a07f0ab9afb2866f91f9355935508 (diff)
parentb40eff542e12ce903a8e25dcd4a6d963fdec99d3 (diff)
downloadQt-2a82051815a3c8bb8fbb2b58dff5653c80d6fa33.zip
Qt-2a82051815a3c8bb8fbb2b58dff5653c80d6fa33.tar.gz
Qt-2a82051815a3c8bb8fbb2b58dff5653c80d6fa33.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/berlin-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/berlin-staging-1: don't falsely complain about mismatched codecfortr Fix QSettings default paths not being initialized when setPath() is called add directories with sources to list of project roots add -codecfortr option sanitize lupdate's behavior regarding SUBDIRS projects absorb cmdline tests into "good" structure add ability to set working dir for test support multiple output files fix printing output from failed command unshare pro post-processing code complain if both sources and projects are given on the cmdline still complain if only ts files where specified on the cmdline do not sort the TS files fix bogus warning message
Diffstat (limited to 'src/corelib/io/qsettings.cpp')
-rw-r--r--src/corelib/io/qsettings.cpp44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 2c31509..64015ce 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1091,30 +1091,23 @@ static inline int pathHashKey(QSettings::Format format, QSettings::Scope scope)
return int((uint(format) << 1) | uint(scope == QSettings::SystemScope));
}
-static QString getPath(QSettings::Format format, QSettings::Scope scope)
+static void initDefaultPaths(QMutexLocker *locker)
{
- Q_ASSERT((int)QSettings::NativeFormat == 0);
- Q_ASSERT((int)QSettings::IniFormat == 1);
-
+ PathHash *pathHash = pathHashFunc();
QString homePath = QDir::homePath();
QString systemPath;
- QMutexLocker locker(globalMutex());
- PathHash *pathHash = pathHashFunc();
- bool loadSystemPath = pathHash->isEmpty();
- locker.unlock();
-
- if (loadSystemPath) {
- /*
- QLibraryInfo::location() uses QSettings, so in order to
- avoid a dead-lock, we can't hold the global mutex while
- calling it.
- */
- systemPath = QLibraryInfo::location(QLibraryInfo::SettingsPath);
- systemPath += QLatin1Char('/');
- }
+ locker->unlock();
+
+ /*
+ QLibraryInfo::location() uses QSettings, so in order to
+ avoid a dead-lock, we can't hold the global mutex while
+ calling it.
+ */
+ systemPath = QLibraryInfo::location(QLibraryInfo::SettingsPath);
+ systemPath += QLatin1Char('/');
- locker.relock();
+ locker->relock();
if (pathHash->isEmpty()) {
/*
Lazy initialization of pathHash. We initialize the
@@ -1155,6 +1148,17 @@ static QString getPath(QSettings::Format format, QSettings::Scope scope)
#endif
#endif
}
+}
+
+static QString getPath(QSettings::Format format, QSettings::Scope scope)
+{
+ Q_ASSERT((int)QSettings::NativeFormat == 0);
+ Q_ASSERT((int)QSettings::IniFormat == 1);
+
+ QMutexLocker locker(globalMutex());
+ PathHash *pathHash = pathHashFunc();
+ if (pathHash->isEmpty())
+ initDefaultPaths(&locker);
QString result = pathHash->value(pathHashKey(format, scope));
if (!result.isEmpty())
@@ -3455,6 +3459,8 @@ void QSettings::setPath(Format format, Scope scope, const QString &path)
{
QMutexLocker locker(globalMutex());
PathHash *pathHash = pathHashFunc();
+ if (pathHash->isEmpty())
+ initDefaultPaths(&locker);
pathHash->insert(pathHashKey(format, scope), path + QDir::separator());
}