diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2011-08-31 15:17:30 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-05 13:31:14 +0200 |
commit | 8ed47d961dc7e6f161030654d11cd330a542eadf (patch) | |
tree | b12d928105e585380ff12c6706fe2f6c62f3cd2a /src/corelib/plugin/qfactoryloader.cpp | |
parent | 6fd75df2889c5635f3de265f40f9d23a35a94d00 (diff) |
Don't use QSettings to "cache" plugin information
The main rationale of the cache was to examine the plugin's build-key
before loading it. Now that the build-key has been removed, the cache
has lost its usefulness.
This is part of a larger push to not use QSettings for Qt specific
settings or caches.
See also:
http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-August/000892.html
http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-August/000960.html
http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-August/000907.html
http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-August/000904.html
Change-Id: I96e84aa25983c8e06e027ff70cef109444c362a2
Reviewed-on: http://codereview.qt.nokia.com/3978
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/plugin/qfactoryloader.cpp')
-rw-r--r-- | src/corelib/plugin/qfactoryloader.cpp | 57 |
1 files changed, 18 insertions, 39 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index c8831e5ae5..c175dcfe1b 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -45,7 +45,6 @@ #include "qfactoryinterface.h" #include "qmap.h" #include <qdir.h> -#include <qsettings.h> #include <qdebug.h> #include "qmutex.h" #include "qplugin.h" @@ -107,7 +106,6 @@ void QFactoryLoader::update() #ifdef QT_SHARED Q_D(QFactoryLoader); QStringList paths = QCoreApplication::libraryPaths(); - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); for (int i = 0; i < paths.count(); ++i) { const QString &pluginDir = paths.at(i); // Already loaded, skip it... @@ -127,7 +125,7 @@ void QFactoryLoader::update() qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName; } library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath()); - if (!library->isPlugin(&settings)) { + if (!library->isPlugin()) { if (qt_debug_component()) { qDebug() << library->errorString; qDebug() << " not a plugin"; @@ -135,45 +133,26 @@ void QFactoryLoader::update() library->release(); continue; } - QString regkey = QString::fromLatin1("Qt Factory Cache %1.%2/%3:/%4") - .arg((QT_VERSION & 0xff0000) >> 16) - .arg((QT_VERSION & 0xff00) >> 8) - .arg(QLatin1String(d->iid)) - .arg(fileName); - QStringList reg, keys; - reg = settings.value(regkey).toStringList(); - if (reg.count() && library->lastModified == reg[0]) { - keys = reg; - keys.removeFirst(); - } else { - if (!library->loadPlugin()) { - if (qt_debug_component()) { - qDebug() << library->errorString; - qDebug() << " could not load"; - } - library->release(); - continue; - } - QObject *instance = library->instance(); - if (!instance) { - library->release(); - // ignore plugins that have a valid signature but cannot be loaded. - continue; + QStringList keys; + if (!library->loadPlugin()) { + if (qt_debug_component()) { + qDebug() << library->errorString; + qDebug() << " could not load"; } - QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance); - if (instance && factory && instance->qt_metacast(d->iid)) - keys = factory->keys(); - if (keys.isEmpty()) - library->unload(); - reg.clear(); - reg << library->lastModified; - reg += keys; - settings.setValue(regkey, reg); + library->release(); + continue; } - if (qt_debug_component()) { - qDebug() << "keys" << keys; + QObject *instance = library->instance(); + if (!instance) { + library->release(); + // ignore plugins that have a valid signature but cannot be loaded. + continue; } - + QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance); + if (instance && factory && instance->qt_metacast(d->iid)) + keys = factory->keys(); + if (keys.isEmpty()) + library->unload(); if (keys.isEmpty()) { library->release(); continue; |