diff --git a/src/libtomahawk/infosystem/InfoSystemWorker.cpp b/src/libtomahawk/infosystem/InfoSystemWorker.cpp index 592b09d82..184abf1d4 100644 --- a/src/libtomahawk/infosystem/InfoSystemWorker.cpp +++ b/src/libtomahawk/infosystem/InfoSystemWorker.cpp @@ -136,6 +136,29 @@ InfoSystemWorker::addInfoPlugin( Tomahawk::InfoSystem::InfoPluginPtr plugin ) emit updatedSupportedGetTypes( QSet< InfoType >::fromList( m_infoGetMap.keys() ) ); emit updatedSupportedPushTypes( QSet< InfoType >::fromList( m_infoPushMap.keys() ) ); + + connect( plugin.data(), SIGNAL( destroyed( QObject* ) ), SLOT( onInfoPluginDeleted() ) ); +} + + +void +InfoSystemWorker::onInfoPluginDeleted() +{ + foreach( const InfoPluginPtr& plugin, m_plugins ) + { + if ( plugin.isNull() ) + { + m_plugins.removeOne( plugin ); + foreach( InfoType type, m_infoGetMap.keys() ) + { + m_infoGetMap[type].removeOne( plugin ); + } + foreach( InfoType type, m_infoPushMap.keys() ) + { + m_infoPushMap[type].removeOne( plugin ); + } + } + } } diff --git a/src/libtomahawk/infosystem/InfoSystemWorker.h b/src/libtomahawk/infosystem/InfoSystemWorker.h index 0e3851f02..15f43c0ba 100644 --- a/src/libtomahawk/infosystem/InfoSystemWorker.h +++ b/src/libtomahawk/infosystem/InfoSystemWorker.h @@ -72,6 +72,7 @@ public slots: private slots: void checkTimeoutsTimerFired(); + void onInfoPluginDeleted(); private: void registerInfoTypes( const InfoPluginPtr &plugin, const QSet< InfoType > &getTypes, const QSet< InfoType > &pushTypes );