Commit fdde8d99 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Fix segfault on item removal on VLM. Patch by Jean-François Massol

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