Commit e4a2f994 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: playlist_model: don't declare array with non constant expression

parent 2d2c0ffa
...@@ -233,7 +233,10 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row ) ...@@ -233,7 +233,10 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
{ {
QList<input_item_t*> inputItems = plMimeData->inputItems(); QList<input_item_t*> inputItems = plMimeData->inputItems();
QList<PLItem*> model_items; QList<PLItem*> model_items;
playlist_item_t *pp_items[inputItems.count()]; playlist_item_t **pp_items;
pp_items = (playlist_item_t **)
calloc( inputItems.count(), sizeof( playlist_item_t* ) );
if ( !pp_items ) return;
PL_LOCK; PL_LOCK;
...@@ -242,7 +245,9 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row ) ...@@ -242,7 +245,9 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
if( !p_parent || row > p_parent->i_children ) if( !p_parent || row > p_parent->i_children )
{ {
PL_UNLOCK; return; PL_UNLOCK;
free( pp_items );
return;
} }
int new_pos = row == -1 ? p_parent->i_children : row; int new_pos = row == -1 ? p_parent->i_children : row;
...@@ -265,7 +270,9 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row ) ...@@ -265,7 +270,9 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
{ {
if( climber == item ) if( climber == item )
{ {
PL_UNLOCK; return; PL_UNLOCK;
free( pp_items );
return;
} }
climber = climber->parent(); climber = climber->parent();
} }
...@@ -281,7 +288,9 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row ) ...@@ -281,7 +288,9 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
if( model_items.isEmpty() ) if( model_items.isEmpty() )
{ {
PL_UNLOCK; return; PL_UNLOCK;
free( pp_items );
return;
} }
playlist_TreeMoveMany( p_playlist, i, pp_items, p_parent, new_pos ); playlist_TreeMoveMany( p_playlist, i, pp_items, p_parent, new_pos );
...@@ -292,6 +301,7 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row ) ...@@ -292,6 +301,7 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
takeItem( item ); takeItem( item );
insertChildren( target, model_items, model_pos ); insertChildren( target, model_items, model_pos );
free( pp_items );
} }
/* remove item with its id */ /* remove item with its id */
......
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