mirror of https://github.com/qt/qtbase.git
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 Pick-to: 6.5 6.6 6.7 Change-Id: Icfc631f9680ad5f484920b0fdf3e408b7657c108 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
b42f174cd5
commit
bdb2f20154
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -224,7 +224,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
|
||||
|
||||
|
|
Loading…
Reference in New Issue