Commit c650d933 authored by Jakob Leben's avatar Jakob Leben

Qt4: don't "leak" playlist items

There was opportunity for playlist items not showing up in Qt playlist due to race between playlist rebuilding and item-added, item-removed callbacks
Maybe also fixes some aspects of #2297 or completely - to test.
parent 6d5e1e70
...@@ -89,6 +89,7 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */ ...@@ -89,6 +89,7 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
ADD_ICON( NODE, ":/type/node" ); ADD_ICON( NODE, ":/type/node" );
#undef ADD_ICON #undef ADD_ICON
addCallbacks();
rebuild( p_root, true ); rebuild( p_root, true );
CONNECT( THEMIM->getIM(), metaChanged( input_item_t *), CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
this, processInputItemUpdate( input_item_t *) ); this, processInputItemUpdate( input_item_t *) );
...@@ -700,11 +701,6 @@ void PLModel::rebuild() ...@@ -700,11 +701,6 @@ void PLModel::rebuild()
void PLModel::rebuild( playlist_item_t *p_root, bool b_first ) void PLModel::rebuild( playlist_item_t *p_root, bool b_first )
{ {
playlist_item_t* p_item; playlist_item_t* p_item;
/* Remove callbacks before locking to avoid deadlocks
The first time the callbacks are not present so
don't try to delete them */
if( !b_first )
delCallbacks();
/* Invalidate cache */ /* Invalidate cache */
i_cached_id = i_cached_input_id = -1; i_cached_id = i_cached_input_id = -1;
...@@ -730,8 +726,6 @@ void PLModel::rebuild( playlist_item_t *p_root, bool b_first ) ...@@ -730,8 +726,6 @@ void PLModel::rebuild( playlist_item_t *p_root, bool b_first )
reset(); reset();
emit currentChanged( index( currentItem, 0 ) ); emit currentChanged( index( currentItem, 0 ) );
addCallbacks();
} }
void PLModel::takeItem( PLItem *item ) void PLModel::takeItem( PLItem *item )
......
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