Permalink
Browse files

Properly remove ScriptCollection ViewPages to prevent crash.

  • Loading branch information...
1 parent b18fac9 commit c4fbcdfcbc5b251add7f292cca37615c875703c0 @teo teo committed Mar 2, 2013
Showing with 3 additions and 2 deletions.
  1. +1 −2 src/sourcetree/SourcesModel.cpp
  2. +2 −0 src/sourcetree/items/ScriptCollectionItem.cpp
@@ -537,7 +537,6 @@ SourcesModel::onScriptCollectionRemoved( const collection_ptr& collection )
m_cloudGroup->removeChild( item );
endRemoveRows();
- dynamic_cast< QObject* >( m_scriptCollectionPages.value( collection ) )->deleteLater();
m_scriptCollectionPages.remove( collection );
m_scriptCollections.remove( collection );
item->deleteLater();
@@ -547,7 +546,7 @@ SourcesModel::onScriptCollectionRemoved( const collection_ptr& collection )
ViewPage*
SourcesModel::scriptCollectionClicked( const Tomahawk::collection_ptr& collection )
{
- m_scriptCollectionPages[ collection ] = ViewManager::instance()->show( collection );
+ m_scriptCollectionPages.insert( collection, ViewManager::instance()->show( collection ) );
return m_scriptCollectionPages[ collection ];
}
@@ -33,6 +33,8 @@ ScriptCollectionItem::ScriptCollectionItem( SourcesModel* model,
ScriptCollectionItem::~ScriptCollectionItem()
{
model()->removeSourceItemLink( this );
+ ViewManager::instance()->destroyPage( m_page );
+ dynamic_cast< QObject* >( m_page )->deleteLater();
}

0 comments on commit c4fbcdf

Please sign in to comment.