diff --git a/src/libtomahawk/resolvers/ScriptInfoPlugin.cpp b/src/libtomahawk/resolvers/ScriptInfoPlugin.cpp index 0a6e12b96..2305c0b7e 100644 --- a/src/libtomahawk/resolvers/ScriptInfoPlugin.cpp +++ b/src/libtomahawk/resolvers/ScriptInfoPlugin.cpp @@ -39,6 +39,8 @@ ScriptInfoPlugin::ScriptInfoPlugin( ScriptObject* scriptObject, const QString& n m_supportedPushTypes = parseSupportedTypes( m_scriptObject->syncInvoke( "supportedPushTypes" ) ); setFriendlyName( QString( "ScriptInfoPlugin: %1" ).arg( name ) ); + + connect( scriptObject, SIGNAL( destroyed( QObject* ) ), SLOT( onScriptObjectDeleted() ) ); } @@ -47,6 +49,13 @@ ScriptInfoPlugin::~ScriptInfoPlugin() } +void +ScriptInfoPlugin::onScriptObjectDeleted() +{ + deleteLater(); +} + + void ScriptInfoPlugin::init() { diff --git a/src/libtomahawk/resolvers/ScriptInfoPlugin.h b/src/libtomahawk/resolvers/ScriptInfoPlugin.h index cab46ba96..9365748b8 100644 --- a/src/libtomahawk/resolvers/ScriptInfoPlugin.h +++ b/src/libtomahawk/resolvers/ScriptInfoPlugin.h @@ -54,6 +54,9 @@ protected slots: void onGetInfoRequestDone( const QVariantMap& result ); void onNotInCacheRequestDone( const QVariantMap& result ); + // boilerplate: to be removed with Qt5 (can be put into ScriptPlugin) + void onScriptObjectDeleted(); + private: static QSet< Tomahawk::InfoSystem::InfoType > parseSupportedTypes(const QVariant& variant); static QString serializeQVariantMap(const QVariantMap& map);