summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-03-09 14:06:51 +0100
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-03-10 11:48:24 +0000
commitd96c29a5d14d142e81e5a2fd1b838a85a0fca187 (patch)
tree1826c6ca178d3efe67896893ac4bee0c3de48ef6 /src/corelib/global
parent35ee5349f2f549d5fe9d9bd57cef7af0047ee2d4 (diff)
Reload QLibraryInfo's settings when QCoreApplication becomes available
Some of the paths may only be resolvable if the application path is known. On some platforms we can only figure out the application path if argv[0] is known. Thus, if the paths have been queried before the QCoreApplication is created, the cached settings may be wrong. We have to reload them after creating the QCoreApplication. Task-number: QTBUG-38598 Change-Id: Idf5822be87aa0872b099480040acd7b49939a22c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qlibraryinfo.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 322fc2f651..24afe719c1 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -63,12 +63,16 @@ extern void qDumpCPUFeatures(); // in qsimd.cpp
struct QLibrarySettings
{
QLibrarySettings();
+ void load();
+
QScopedPointer<QSettings> settings;
#ifdef QT_BUILD_QMAKE
bool haveDevicePaths;
bool haveEffectiveSourcePaths;
bool haveEffectivePaths;
bool havePaths;
+#else
+ bool reloadOnQAppAvailable;
#endif
};
Q_GLOBAL_STATIC(QLibrarySettings, qt_library_settings)
@@ -93,16 +97,31 @@ public:
static QSettings *configuration()
{
QLibrarySettings *ls = qt_library_settings();
- return ls ? ls->settings.data() : 0;
+ if (ls) {
+#ifndef QT_BUILD_QMAKE
+ if (ls->reloadOnQAppAvailable && QCoreApplication::instance() != 0)
+ ls->load();
+#endif
+ return ls->settings.data();
+ } else {
+ return 0;
+ }
}
};
static const char platformsSection[] = "Platforms";
QLibrarySettings::QLibrarySettings()
- : settings(QLibraryInfoPrivate::findConfiguration())
{
+ load();
+}
+
+void QLibrarySettings::load()
+{
+ // If we get any settings here, those won't change when the application shows up.
+ settings.reset(QLibraryInfoPrivate::findConfiguration());
#ifndef QT_BUILD_QMAKE
+ reloadOnQAppAvailable = (settings.data() == 0 && QCoreApplication::instance() == 0);
bool haveDevicePaths;
bool haveEffectivePaths;
bool havePaths;