Commit 65211483 authored by Jakob Leben's avatar Jakob Leben

Qt4: fix segfault when exiting after a service discovery has been activated

parent eca521d9
...@@ -526,6 +526,7 @@ PLItem *PLModel::findByInput( PLItem *root, int i_id ) ...@@ -526,6 +526,7 @@ PLItem *PLModel::findByInput( PLItem *root, int i_id )
PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_input ) PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_input )
{ {
if( !root ) return NULL;
if( ( !b_input && i_cached_id == i_id) || if( ( !b_input && i_cached_id == i_id) ||
( b_input && i_cached_input_id ==i_id ) ) ( b_input && i_cached_input_id ==i_id ) )
{ {
...@@ -755,14 +756,21 @@ void PLModel::insertChildren( PLItem *node, QList<PLItem*>& items, int i_pos ) ...@@ -755,14 +756,21 @@ void PLModel::insertChildren( PLItem *node, QList<PLItem*>& items, int i_pos )
void PLModel::removeItem( PLItem *item ) void PLModel::removeItem( PLItem *item )
{ {
if( !item ) return; if( !item ) return;
if( currentItem == item ) if( currentItem == item )
{ {
currentItem = NULL; currentItem = NULL;
emit currentChanged( QModelIndex() ); emit currentChanged( QModelIndex() );
} }
PLItem *parent = item->parentItem;
assert( parent ); if( item->parentItem ) item->parentItem->removeChild( item );
parent->removeChild( item ); else delete item;
if(item == rootItem)
{
rootItem = NULL;
reset();
}
} }
/* This function must be entered WITH the playlist lock */ /* This function must be entered WITH the playlist lock */
......
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