changeset 35522:92809c17fc9d

Fix bug with removing items from playlist. When removing files from the playlist in the playlist editor not all selected items towards the end of the list were removed. Patch by Hans-Dieter Kosch, hdkosch kabelbw de.
author ib
date Thu, 06 Dec 2012 00:57:30 +0000
parents baf53d200292
children 1857fa5cbfcb
files gui/ui/gtk/playlist.c
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/gui/ui/gtk/playlist.c	Wed Dec 05 23:28:14 2012 +0000
+++ b/gui/ui/gtk/playlist.c	Thu Dec 06 00:57:30 2012 +0000
@@ -247,22 +247,25 @@
        break;
   case 2: // remove
        {
-	int i; int j; int c=0;
+	int i; int j;
 
 	gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigSel );
 	gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigUnsel );
 	gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigEvent );
 
         gtk_clist_freeze( GTK_CLIST( CLSelected ) );
-        for ( i=0;i<NrOfSelected-c;i++ )
+        i = 0;
+        while ( i<NrOfSelected )
+        {
   	 if ( CLListSelected[i] )
 	  {
-	   gtk_clist_remove( GTK_CLIST( CLSelected ),i - c );
-	   c++;
-	   for ( j=i;j<NrOfSelected-c;j++ )
-		CLListSelected[i] = CLListSelected[i+1];
+	   gtk_clist_remove( GTK_CLIST( CLSelected ),i );
+	   NrOfSelected--;
+	   for ( j=i;j<NrOfSelected;j++ )
+		CLListSelected[j] = CLListSelected[j+1];
 	  }
-	NrOfSelected-=c;
+  	 else i++;
+        }
 	gtk_clist_thaw( GTK_CLIST( CLSelected ) );
 
 	gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigSel );