]> git.sesse.net Git - vlc/commitdiff
macosx: work-around a crash when deleting an entire playlist root
authorFelix Paul Kühne <fkuehne@videolan.org>
Fri, 24 Feb 2012 15:55:51 +0000 (16:55 +0100)
committerFelix Paul Kühne <fkuehne@videolan.org>
Fri, 24 Feb 2012 15:57:23 +0000 (16:57 +0100)
modules/gui/macosx/playlist.m

index 97570056e6732a8033a421edfb27ba3b1d9a54e8..4f78e0bd7e850c668b571aad56e9e825c1b12add 100644 (file)
     p_playlist = pl_Get( p_intf );
 
     NSUInteger indexes[i_count];
+    if (i_count == [o_outline_view numberOfRows])
+    {
+#ifndef NDEBUG
+        msg_Dbg( p_intf, "user selected entire list, deleting current playlist root instead of individual items" );
+#endif
+        PL_LOCK;
+        playlist_NodeDelete( p_playlist, [self currentPlaylistRoot], true, false );
+        PL_UNLOCK;
+        [self playlistUpdated];
+        return;
+    }
     [o_selected_indexes getIndexes:indexes maxCount:i_count inIndexRange:nil];
     for (int i = 0; i < i_count; i++)
     {
                 // if current item is in selected node and is playing then stop playlist
                 playlist_Control(p_playlist, PLAYLIST_STOP, pl_Locked );
 
-            playlist_NodeDelete( p_playlist, p_item, true, false );
+                playlist_NodeDelete( p_playlist, p_item, true, false );
         }
         else
             playlist_DeleteFromInput( p_playlist, p_item->p_input, pl_Locked );