Commit 00ee289f authored by Ilkka Ollakka's avatar Ilkka Ollakka

qt4: don't crash when sd is selected in playlist and unloaded from menu

Currently doesn't yet reset view to default playlist. Atleast worked for me
parent aeaf15c3
...@@ -760,12 +760,15 @@ void PLModel::removeItem( PLItem *item ) ...@@ -760,12 +760,15 @@ void PLModel::removeItem( PLItem *item )
if( item->i_id == i_cached_id ) i_cached_id = -1; if( item->i_id == i_cached_id ) i_cached_id = -1;
i_cached_input_id = -1; i_cached_input_id = -1;
if( currentItem == item ) if( currentItem == item || rootItem == item)
{ {
currentItem = NULL; currentItem = NULL;
emit currentChanged( QModelIndex() ); emit currentChanged( QModelIndex() );
} }
if(item == rootItem)
rootItem = NULL;
if( item->parentItem ) { if( item->parentItem ) {
int i = item->parentItem->children.indexOf( item ); int i = item->parentItem->children.indexOf( item );
beginRemoveRows( index( item->parentItem, 0), i, i ); beginRemoveRows( index( item->parentItem, 0), i, i );
...@@ -775,11 +778,6 @@ void PLModel::removeItem( PLItem *item ) ...@@ -775,11 +778,6 @@ void PLModel::removeItem( PLItem *item )
} }
else delete item; else delete item;
if(item == rootItem)
{
rootItem = NULL;
reset();
}
} }
/* This function must be entered WITH the playlist lock */ /* This function must be entered WITH the playlist lock */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment