summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index 943fb35ab6..1288643e32 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -183,7 +183,7 @@ void QFactoryLoader::update()
continue;
}
- d->libraryList += library;
+ int keyUsageCount = 0;
for (int k = 0; k < keys.count(); ++k) {
// first come first serve, unless the first
// library was built with a future Qt version,
@@ -198,8 +198,13 @@ void QFactoryLoader::update()
int qt_version = (int)library->metaData.value(QLatin1String("version")).toDouble();
if (!previous || (prev_qt_version > QT_VERSION && qt_version <= QT_VERSION)) {
d->keyMap[key] = library;
+ ++keyUsageCount;
}
}
+ if (keyUsageCount || keys.isEmpty())
+ d->libraryList += library;
+ else
+ library->release();
}
}
#else