summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2011-03-23 12:40:50 (GMT)
committeraavit <qt-info@nokia.com>2011-03-23 15:02:13 (GMT)
commit254e14a81708213312d8b64d73fbc1dfc362b0d0 (patch)
treec703e105f4116a7f6b4d99787ae11d9093e25802 /src/corelib/plugin
parent23098630c94e6655a33042bee0caa6c933c0c7d9 (diff)
downloadQt-254e14a81708213312d8b64d73fbc1dfc362b0d0.zip
Qt-254e14a81708213312d8b64d73fbc1dfc362b0d0.tar.gz
Qt-254e14a81708213312d8b64d73fbc1dfc362b0d0.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
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qlibrary.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index ecd1aac..80e927b 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -516,6 +516,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)
@@ -528,6 +530,9 @@ bool QLibraryPrivate::loadPlugin()
#endif
return instance;
}
+ if (qt_debug_component())
+ qWarning() << "QLibraryPrivate::loadPlugin failed on" << fileName << ":" << errorString;
+ pluginState = IsNotAPlugin;
return false;
}
@@ -687,7 +692,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
@@ -702,7 +707,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
regkey += QLatin1String("-ppc");
#endif
#endif // Q_WS_MAC
-
+
QStringList reg;
#ifndef QT_NO_SETTINGS
if (!settings) {