diff options
author | Alexey Edelev <[email protected]> | 2024-02-27 17:57:05 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <[email protected]> | 2024-03-01 00:28:25 +0000 |
commit | 3f222b6ddcd701dd72bf7aa21eb4c584d43d61f3 (patch) | |
tree | 4332eaca334760cd3e58756a48e5e542eebe0e10 | |
parent | ed6f6c2408f463db0715aa1e5c6c43fb6e57d802 (diff) |
Fix the qtpath issue with lto enabled
Move qtconfManualPath pointer to the unnamed namespace, so it's never
exported. Add the static setQtconfManualPath method that sets the
pointer at runtime.
Fixes: QTBUG-122739
Change-Id: Icfc631f9680ad5f484920b0fdf3e408b7657c108
Reviewed-by: Joerg Bornemann <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
(cherry picked from commit bdb2f20154c1fa1f0962a46a22afdee453a2db1e)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
(cherry picked from commit a405320544a190fac3aaa0bfe8e842e4019e5386)
(cherry picked from commit dc118ad13f28b0721b1118fdbe43a3f5c33ac84a)
-rw-r--r-- | qmake/option.cpp | 2 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 15 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo_p.h | 2 | ||||
-rw-r--r-- | src/tools/qtpaths/qtpaths.cpp | 2 |
4 files changed, 14 insertions, 7 deletions
diff --git a/qmake/option.cpp b/qmake/option.cpp index 09ae39fd3fd..3e8e677e70a 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -188,7 +188,7 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state) return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } if (!globals->qtconf.isEmpty()) - QLibraryInfoPrivate::qtconfManualPath = &globals->qtconf; + QLibraryInfoPrivate::setQtconfManualPath(&globals->qtconf); if (cmdRet == QMakeGlobals::ArgumentsOk) break; Q_ASSERT(cmdRet == QMakeGlobals::ArgumentUnknown); diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index fc23078381a..83e131d5912 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -87,10 +87,19 @@ void QLibrarySettings::load() } } +namespace { +const QString *qtconfManualPath = nullptr; +} + +void QLibraryInfoPrivate::setQtconfManualPath(const QString *path) +{ + qtconfManualPath = path; +} + static QSettings *findConfiguration() { - if (QLibraryInfoPrivate::qtconfManualPath) - return new QSettings(*QLibraryInfoPrivate::qtconfManualPath, QSettings::IniFormat); + if (qtconfManualPath) + return new QSettings(*qtconfManualPath, QSettings::IniFormat); QString qtconfig = QStringLiteral(":/qt/etc/qt.conf"); if (QFile::exists(qtconfig)) @@ -122,8 +131,6 @@ static QSettings *findConfiguration() return nullptr; //no luck } -const QString *QLibraryInfoPrivate::qtconfManualPath = nullptr; - QSettings *QLibraryInfoPrivate::configuration() { QLibrarySettings *ls = qt_library_settings(); diff --git a/src/corelib/global/qlibraryinfo_p.h b/src/corelib/global/qlibraryinfo_p.h index de1964509ca..9eac5959542 100644 --- a/src/corelib/global/qlibraryinfo_p.h +++ b/src/corelib/global/qlibraryinfo_p.h @@ -32,7 +32,7 @@ public: #if QT_CONFIG(settings) static QSettings *configuration(); static void reload(); - static const QString *qtconfManualPath; + static void setQtconfManualPath(const QString *qtconfManualPath); #endif struct LocationInfo diff --git a/src/tools/qtpaths/qtpaths.cpp b/src/tools/qtpaths/qtpaths.cpp index bc694bfcead..fad31ceafa5 100644 --- a/src/tools/qtpaths/qtpaths.cpp +++ b/src/tools/qtpaths/qtpaths.cpp @@ -222,7 +222,7 @@ int main(int argc, char **argv) #if QT_CONFIG(settings) if (parser.isSet(qtconf)) { qtconfManualPath = parser.value(qtconf); - QLibraryInfoPrivate::qtconfManualPath = &qtconfManualPath; + QLibraryInfoPrivate::setQtconfManualPath(&qtconfManualPath); } #endif |