From b0d788f7a9cf1be096afe56f95ca56d8ec2313e1 Mon Sep 17 00:00:00 2001 From: Mike Chen Date: Thu, 19 Dec 2024 17:25:17 +0800 Subject: [PATCH] QFactoryLoader: load extraSearchPath first Since `QT_QPA_PLATFORM_PLUGIN_PATH` or `-platformpluginpath` specifies the path to platform plugins, `extraSearchPath` should be loaded first. Change-Id: I2e62fbf2021250ca864c669a7bbd7d56acd67d1e Reviewed-by: Thiago Macieira (cherry picked from commit 457580936ddebc73e8a24fc8af0d342084b3a0b5) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit b6108318c2a7e79c297e6fa7cdc9f6de88b6efa9) --- src/corelib/plugin/qfactoryloader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index c457e332a41..730fb0de5ed 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -394,6 +394,9 @@ void QFactoryLoader::update() #ifdef QT_SHARED Q_D(QFactoryLoader); + if (!d->extraSearchPath.isEmpty()) + d->updateSinglePath(d->extraSearchPath); + const QStringList paths = QCoreApplication::libraryPaths(); for (const QString &pluginDir : paths) { #ifdef Q_OS_ANDROID @@ -401,11 +404,8 @@ void QFactoryLoader::update() #else QString path = pluginDir + d->suffix; #endif - d->updateSinglePath(path); } - if (!d->extraSearchPath.isEmpty()) - d->updateSinglePath(d->extraSearchPath); #else Q_D(QFactoryLoader); qCDebug(lcFactoryLoader) << "ignoring" << d->iid