diff options
author | aavit <qt-info@nokia.com> | 2011-03-23 12:40:50 (GMT) |
---|---|---|
committer | Qt Commercial Integration <QtCommercial@digia.com> | 2012-01-31 10:24:52 (GMT) |
commit | b5a1d5afbe6e238cc17df9255c2474b4b26cee94 (patch) | |
tree | 42957cdf35dd9b956b62d2a232e0121f6faad440 | |
parent | 8be4ea0063dac6091ce896d019a149864b5d0003 (diff) | |
download | Qt-b5a1d5afbe6e238cc17df9255c2474b4b26cee94.zip Qt-b5a1d5afbe6e238cc17df9255c2474b4b26cee94.tar.gz Qt-b5a1d5afbe6e238cc17df9255c2474b4b26cee94.tar.bz2 |
Avoid repeatedly trying to load unloadable plugins, causing slowness
In certain uncommon situations, where different Qt versions are used
on the same system, the plugin caching optimization may identify a dll
as a valid plugin, even though it will later fail to load. This fix
will avoid that Qt repeatdly tries to reopen such dlls, something
which caused a significant performance hit in these cases. E.g. where
Qt would unsuccessfully try to load a number of KDE image format plugins
for every image loading operation.
Task-number: QTBUG-10066
Reviewed-by: thiago
Reviewed-by: janarve
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 1d8196f..8b41baa 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -475,6 +475,8 @@ bool QLibraryPrivate::loadPlugin() libraryUnloadCount.ref(); return true; } + if (pluginState == IsNotAPlugin) + return false; if (load()) { instance = (QtPluginInstanceFunction)resolve("qt_plugin_instance"); #if defined(Q_OS_SYMBIAN) @@ -487,6 +489,9 @@ bool QLibraryPrivate::loadPlugin() #endif return instance; } + if (qt_debug_component()) + qWarning() << "QLibraryPrivate::loadPlugin failed on" << fileName << ":" << errorString; + pluginState = IsNotAPlugin; return false; } @@ -606,7 +611,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) .arg((QT_VERSION & 0xff00) >> 8) .arg(QLIBRARY_AS_DEBUG ? QLatin1String("debug") : QLatin1String("false")) .arg(fileName); -#ifdef Q_WS_MAC +#ifdef Q_WS_MAC // On Mac, add the application arch to the reg key in order to // cache plugin information separately for each arch. This prevents // Qt from wrongly caching plugin load failures when the archs @@ -621,7 +626,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) regkey += QLatin1String("-ppc"); #endif #endif // Q_WS_MAC - + QStringList reg; #ifndef QT_NO_SETTINGS if (!settings) { |