]> git.sesse.net Git - vlc/commitdiff
Qt4 - Fix segfault on item removal on VLM. Patch by Jean-François Massol
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 17 Jan 2008 22:43:57 +0000 (22:43 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 17 Jan 2008 22:43:57 +0000 (22:43 +0000)
modules/gui/qt4/dialogs/vlm.cpp

index 10e906d90b4f0a08c8b8bd7093aa54deb9f52227..3b28516a2a1b1b9ee82ce67a5a9353112a951af1 100644 (file)
@@ -161,7 +161,8 @@ void VLMDialog::showScheduleWidget( int i )
 
 void VLMDialog::selectVLMItem( int i )
 {
-    ui.vlmItemScroll->ensureWidgetVisible( vlmItems.at( i ) );
+    if( i >= 0 )
+        ui.vlmItemScroll->ensureWidgetVisible( vlmItems.at( i ) );
 }
 
 bool VLMDialog::isNameGenuine( QString name )
@@ -228,6 +229,7 @@ void VLMDialog::addVLMItem()
 
     vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
     vlmItems.append( vlmAwidget );
+    clearWidgets();
 }
 
 void VLMDialog::clearWidgets()
@@ -265,7 +267,6 @@ void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
     int index = vlmItems.indexOf( vlmObj );
     if( index < 0 ) return;
 
-    //FIXME, this is going to segfault if the focus in on the ListWidget
     delete ui.vlmListItem->takeItem( index );
     vlmItems.removeAt( index );
     delete vlmObj;