diff options
-rw-r--r-- | sigencore/plugins/PluginBase.cpp | 5 | ||||
-rw-r--r-- | sigtools/PluginLoader.cpp | 7 | ||||
-rw-r--r-- | sigtools/PluginLoader_p.h | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/sigencore/plugins/PluginBase.cpp b/sigencore/plugins/PluginBase.cpp index 9c13093a..0c6ba58f 100644 --- a/sigencore/plugins/PluginBase.cpp +++ b/sigencore/plugins/PluginBase.cpp @@ -18,6 +18,9 @@ // Header include #include "PluginBase.h" +// Qt includes +#include <QtCore/QtDebug> + using namespace Sigencore::Plugins; PluginBase::PluginBase(QObject* parent, const QVariantList& args) : @@ -29,6 +32,8 @@ PluginBase::PluginBase(QObject* parent, const QVariantList& args) : PluginBase::~PluginBase() { + if (m_count) + qCritical() << "There are still" << m_count << "classes in use by a plugin when deleted"; } int PluginBase::classesUsedCount() const diff --git a/sigtools/PluginLoader.cpp b/sigtools/PluginLoader.cpp index 37eb9bc6..8c6f00ad 100644 --- a/sigtools/PluginLoader.cpp +++ b/sigtools/PluginLoader.cpp @@ -34,7 +34,6 @@ #include <KStandardDirs> // Qt includes -#include <QtCore/QtDebug> #include <QtCore/QFile> using namespace Sigmod; @@ -231,18 +230,16 @@ QSharedPointer<Game> PluginLoader::Private::game(const QString& name) return QSharedPointer<Game>(); } -void PluginLoader::Private::clean(const QString& type, const bool errorOnExtra) +void PluginLoader::Private::clean(const QString& type, const bool forceDeletion) { QMutableListIterator<PluginBase*> i(m_plugins[type]); while (i.hasNext()) { i.next(); - if (!i.value()->classesUsedCount()) + if (forceDeletion || !i.value()->classesUsedCount()) { delete i.value(); i.remove(); } - else if (errorOnExtra) - qCritical() << "There are still" << i.value()->classesUsedCount() << "classes in use by a plugin of type" << type; } } diff --git a/sigtools/PluginLoader_p.h b/sigtools/PluginLoader_p.h index ec2e9750..95caa92d 100644 --- a/sigtools/PluginLoader_p.h +++ b/sigtools/PluginLoader_p.h @@ -60,7 +60,7 @@ class SIGTOOLS_NO_EXPORT Private : public QObject Sigencore::Plugins::PluginBase* factory(const QString& type, const QString& name); QSharedPointer<Sigmod::Game> game(const QString& name); protected: - void clean(const QString& type, const bool errorOnExtra = false); + void clean(const QString& type, const bool forceDeletion = false); typedef QPair<KService::Ptr, Sigencore::Plugins::PluginBase*> Service; typedef QMap<QString, Service> PluginList; |