]> git.sesse.net Git - vlc/commitdiff
qt4: don't crash when sd is selected in playlist and unloaded from menu
authorIlkka Ollakka <ileoo@iki.fi>
Thu, 29 Oct 2009 17:15:53 +0000 (19:15 +0200)
committerIlkka Ollakka <ileoo@iki.fi>
Thu, 29 Oct 2009 17:21:29 +0000 (19:21 +0200)
Currently doesn't yet reset view to default playlist. Atleast worked for me

modules/gui/qt4/components/playlist/playlist_model.cpp

index 62cbcc522e50e5b0b2ebd2dd8ec0d1c62d4619fb..198cb854eeeea4c7102098104f0e30aeb1cba79a 100644 (file)
@@ -760,12 +760,15 @@ void PLModel::removeItem( PLItem *item )
     if( item->i_id == i_cached_id ) i_cached_id = -1;
     i_cached_input_id = -1;
 
-    if( currentItem == item )
+    if( currentItem == item || rootItem == item)
     {
         currentItem = NULL;
         emit currentChanged( QModelIndex() );
     }
 
+    if(item == rootItem)
+        rootItem = NULL;
+
     if( item->parentItem ) {
         int i = item->parentItem->children.indexOf( item );
         beginRemoveRows( index( item->parentItem, 0), i, i );
@@ -775,11 +778,6 @@ void PLModel::removeItem( PLItem *item )
     }
     else delete item;
 
-    if(item == rootItem)
-    {
-        rootItem = NULL;
-        reset();
-    }
 }
 
 /* This function must be entered WITH the playlist lock */