diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-06-28 08:56:44 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-28 08:58:49 +0200 |
commit | be35b70ca1bf61d022f7dee9df4aaccbf715b25e (patch) | |
tree | dd59ae3713b2bc516101f921491292a8b2c295e3 /src/corelib/plugin/qfactoryloader.cpp | |
parent | cc54161abb977751b4499c559fc0f464b9e2399e (diff) | |
parent | 572200989b224ad68e7b8ae4c0aecceb6ca871a2 (diff) |
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/plugin/qfactoryloader.cpp')
-rw-r--r-- | src/corelib/plugin/qfactoryloader.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 61c9b40e83..c617325e9e 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -72,7 +72,6 @@ public: QByteArray iid; QList<QLibraryPrivate*> libraryList; QMap<QString,QLibraryPrivate*> keyMap; - QStringList keyList; QString suffix; Qt::CaseSensitivity cs; QStringList loadedPaths; @@ -176,10 +175,8 @@ void QFactoryLoader::update() metaDataOk = true; QJsonArray k = object.value(QLatin1String("Keys")).toArray(); - for (int i = 0; i < k.size(); ++i) { - QString s = k.at(i).toString(); - keys += s; - } + for (int i = 0; i < k.size(); ++i) + keys += d->cs ? k.at(i).toString() : k.at(i).toString().toLower(); } if (qt_debug_component()) qDebug() << "Got keys from plugin meta data" << keys; @@ -190,15 +187,13 @@ 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, // whereas the new one has a Qt version that fits // better - QString key = keys.at(k); - if (!d->cs) - key = key.toLower(); + const QString &key = keys.at(k); QLibraryPrivate *previous = d->keyMap.value(key); int prev_qt_version = 0; if (previous) { @@ -207,9 +202,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; - d->keyList += keys.at(k); + ++keyUsageCount; } } + if (keyUsageCount || keys.isEmpty()) + d->libraryList += library; + else + library->release(); } } #else |