mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 23:57:34 +02:00
Remove script objects automatically from ScriptAccount when they are deleted
This commit is contained in:
@@ -92,6 +92,7 @@ ScriptAccount::registerScriptPlugin( const QString& type, const QString& objectI
|
||||
if( !object )
|
||||
{
|
||||
object = new ScriptObject( objectId, this );
|
||||
connect( object, SIGNAL( destroyed( QObject* ) ), SLOT( onScriptObjectDeleted( QObject* ) ) );
|
||||
m_objects.insert( objectId, object );
|
||||
}
|
||||
|
||||
@@ -99,6 +100,13 @@ ScriptAccount::registerScriptPlugin( const QString& type, const QString& objectI
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptAccount::onScriptObjectDeleted( QObject* scriptObject )
|
||||
{
|
||||
m_objects.remove( m_objects.key( static_cast< ScriptObject* >( scriptObject ) ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptAccount::scriptPluginFactory( const QString& type, ScriptObject* object )
|
||||
{
|
||||
|
@@ -55,6 +55,8 @@ public:
|
||||
private slots:
|
||||
void onJobDeleted( const QString& jobId );
|
||||
|
||||
void onScriptObjectDeleted( QObject* scriptObject );
|
||||
|
||||
private: // TODO: pimple, might be renamed before tho
|
||||
QString m_name;
|
||||
QHash< QString, ScriptJob* > m_jobs;
|
||||
|
Reference in New Issue
Block a user