From db0169bcd9f6a6c5105053f0de16dac790efa87f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 5 Apr 2023 14:05:42 -0300 Subject: [PATCH] Q{Plugin,Factory}Loader: downgrade warnings to debug messages Since we don't have different environment variables for the plugin paths, users have to set QT_PLUGIN_PATH to where plugins for both Qt 5 and 6 (and future versions) are located. This causes Qt to print warnings that those couldn't be loaded because the major version mismatches. So don't print them any more. QT_DEBUG_PLUGINS and the category logging filter can still be used to enable them. Fixes: QTBUG-107459 Change-Id: Idd5e1bb52be047d7b4fffffd175318ca1f8017bd Reviewed-by: Lars Knoll (cherry picked from commit 25e13c9079fbc441ecf37c8a601dd88cdebd0b49) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/plugin/qlibrary.cpp | 4 ++-- tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index d4f9235538f..783d457bd50 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -258,7 +258,7 @@ static QLibraryScanResult findPatternUnloaded(const QString &library, QLibraryPr #endif if (!lib->metaData.parse(QByteArrayView(filedata + r.pos, r.length))) { errMsg = lib->metaData.errorString(); - qCWarning(qt_lcDebugPlugins, "Found invalid metadata in lib %ls: %ls", + qCDebug(qt_lcDebugPlugins, "Found invalid metadata in lib %ls: %ls", qUtf16Printable(library), qUtf16Printable(errMsg)); } else { qCDebug(qt_lcDebugPlugins, "Found metadata in lib %ls, metadata=\n%s\n", @@ -766,7 +766,7 @@ void QLibraryPrivate::updatePluginState() uint qt_version = uint(metaData.value(QtPluginMetaDataKeys::QtVersion).toInteger()); bool debug = metaData.value(QtPluginMetaDataKeys::IsDebug).toBool(); if ((qt_version & 0x00ff00) > (QT_VERSION & 0x00ff00) || (qt_version & 0xff0000) != (QT_VERSION & 0xff0000)) { - qCWarning(qt_lcDebugPlugins, "In %s:\n" + qCDebug(qt_lcDebugPlugins, "In %s:\n" " Plugin uses incompatible Qt library (%d.%d.%d) [%s]", QFile::encodeName(fileName).constData(), (qt_version&0xff0000) >> 16, (qt_version&0xff00) >> 8, qt_version&0xff, diff --git a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp index 5af39c4f3e6..aaed702320c 100644 --- a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp +++ b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp @@ -224,10 +224,6 @@ void tst_QPlugin::scanInvalidPlugin() // now try to load this QFETCH(bool, loads); QFETCH(QString, errMsg); - if (!errMsg.isEmpty()) - QTest::ignoreMessage(QtWarningMsg, - "Found invalid metadata in lib " + QFile::encodeName(newName) + - ":" + errMsg.toUtf8()); QPluginLoader loader(newName); QCOMPARE(loader.load(), loads); if (loads)