vlc | branch: master | Filip Roséen <[email protected]> | Wed Jul 20 04:36:55 2016 +0200| [165d24cd68e7127a07e733288575237ebd585185] | committer: Jean-Baptiste Kempf
gui/qt: use vlc_playlist_locker in PLModel::dropMove Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=165d24cd68e7127a07e733288575237ebd585185 --- .../gui/qt/components/playlist/playlist_model.cpp | 88 ++++++++++---------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp index b4bcd6d..a62c8ce 100644 --- a/modules/gui/qt/components/playlist/playlist_model.cpp +++ b/modules/gui/qt/components/playlist/playlist_model.cpp @@ -197,64 +197,62 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row ) calloc( inputItems.count(), sizeof( playlist_item_t* ) ); if ( !pp_items ) return; - PL_LOCK; - - playlist_item_t *p_parent = - playlist_ItemGetByInput( p_playlist, target->inputItem() ); + int model_pos; - if( !p_parent || row > p_parent->i_children ) { - PL_UNLOCK; - free( pp_items ); - return; - } + vlc_playlist_locker pl_lock ( THEPL ); - int new_pos = row == -1 ? p_parent->i_children : row; - int model_pos = new_pos; - int i = 0; + playlist_item_t *p_parent = + playlist_ItemGetByInput( p_playlist, target->inputItem() ); - foreach( input_item_t *p_input, inputItems ) - { - playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input ); - if( !p_item ) continue; + if( !p_parent || row > p_parent->i_children ) + { + free( pp_items ); + return; + } - PLItem *item = findByInputId( rootItem, p_input->i_id ); - if( !item ) continue; + int new_pos = model_pos = row == -1 ? p_parent->i_children : row; + int i = 0; - /* Better not try to move a node into itself. - Abort the whole operation in that case, - because it is ambiguous. */ - AbstractPLItem *climber = target; - while( climber ) + foreach( input_item_t *p_input, inputItems ) { - if( climber == item ) + playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input ); + if( !p_item ) continue; + + PLItem *item = findByInputId( rootItem, p_input->i_id ); + if( !item ) continue; + + /* Better not try to move a node into itself. + Abort the whole operation in that case, + because it is ambiguous. */ + AbstractPLItem *climber = target; + while( climber ) { - PL_UNLOCK; - free( pp_items ); - return; + if( climber == item ) + { + free( pp_items ); + return; + } + climber = climber->parent(); } - climber = climber->parent(); - } - if( item->parent() == target && - target->children.indexOf( item ) < new_pos ) - model_pos--; + if( item->parent() == target && + target->children.indexOf( item ) < new_pos ) + model_pos--; - model_items.append( item ); - pp_items[i] = p_item; - i++; - } - - if( model_items.isEmpty() ) - { - PL_UNLOCK; - free( pp_items ); - return; - } + model_items.append( item ); + pp_items[i] = p_item; + i++; + } - playlist_TreeMoveMany( p_playlist, i, pp_items, p_parent, new_pos ); + if( model_items.isEmpty() ) + { + free( pp_items ); + return; + } - PL_UNLOCK; + playlist_TreeMoveMany( p_playlist, i, pp_items, p_parent, new_pos ); + } foreach( PLItem *item, model_items ) takeItem( item ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
