Commit afc6b18d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Sort the playlist under a static lock due to static variables

parent 4db7858c
...@@ -104,6 +104,7 @@ int playlist_RecursiveNodeSort( playlist_t *p_playlist, playlist_item_t *p_node, ...@@ -104,6 +104,7 @@ int playlist_RecursiveNodeSort( playlist_t *p_playlist, playlist_item_t *p_node,
static int sort_mode = 0; static int sort_mode = 0;
static int sort_type = 0; static int sort_type = 0;
static vlc_mutex_t sort_lock = VLC_STATIC_MUTEX;
static int playlist_ItemArraySort( playlist_t *p_playlist, int i_items, static int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
playlist_item_t **pp_items, int i_mode, playlist_item_t **pp_items, int i_mode,
...@@ -111,6 +112,8 @@ static int playlist_ItemArraySort( playlist_t *p_playlist, int i_items, ...@@ -111,6 +112,8 @@ static int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
{ {
int i_position; int i_position;
playlist_item_t *p_temp; playlist_item_t *p_temp;
vlc_mutex_lock( &sort_lock );
sort_mode = i_mode; sort_mode = i_mode;
sort_type = i_type; sort_type = i_type;
...@@ -134,6 +137,7 @@ static int playlist_ItemArraySort( playlist_t *p_playlist, int i_items, ...@@ -134,6 +137,7 @@ static int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
qsort(pp_items,i_items,sizeof(pp_items[0]),playlist_cmp); qsort(pp_items,i_items,sizeof(pp_items[0]),playlist_cmp);
vlc_mutex_unlock( &sort_lock );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
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