Commit e5ca8a9b authored by Jakob Leben's avatar Jakob Leben

Qt: kill a bug in playlist model

parent 376ecc67
...@@ -609,6 +609,7 @@ void PLModel::processItemAppend( int i_item, int i_parent ) ...@@ -609,6 +609,7 @@ void PLModel::processItemAppend( int i_item, int i_parent )
playlist_item_t *p_item = NULL; playlist_item_t *p_item = NULL;
PLItem *newItem = NULL; PLItem *newItem = NULL;
input_thread_t *currentInputThread; input_thread_t *currentInputThread;
int pos;
PLItem *nodeItem = findById( rootItem, i_parent ); PLItem *nodeItem = findById( rootItem, i_parent );
if( !nodeItem ) return; if( !nodeItem ) return;
...@@ -620,6 +621,9 @@ void PLModel::processItemAppend( int i_item, int i_parent ) ...@@ -620,6 +621,9 @@ void PLModel::processItemAppend( int i_item, int i_parent )
p_item = playlist_ItemGetById( p_playlist, i_item ); p_item = playlist_ItemGetById( p_playlist, i_item );
if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG ) goto end; if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG ) goto end;
for( pos = 0; pos < p_item->p_parent->i_children; pos++ )
if( p_item->p_parent->pp_children[pos] == p_item ) break;
newItem = new PLItem( p_item, nodeItem ); newItem = new PLItem( p_item, nodeItem );
PL_UNLOCK; PL_UNLOCK;
...@@ -628,8 +632,8 @@ void PLModel::processItemAppend( int i_item, int i_parent ) ...@@ -628,8 +632,8 @@ void PLModel::processItemAppend( int i_item, int i_parent )
newItem->p_input == input_GetItem( currentInputThread ) ) newItem->p_input == input_GetItem( currentInputThread ) )
currentItem = newItem; currentItem = newItem;
beginInsertRows( index( nodeItem, 0 ), nodeItem->childCount(), nodeItem->childCount() ); beginInsertRows( index( nodeItem, 0 ), pos, pos );
nodeItem->appendChild( newItem ); nodeItem->insertChild( newItem, pos );
endInsertRows(); endInsertRows();
if( currentItem == newItem ) if( currentItem == newItem )
......
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