[vlc-commits] ml: Ensure list lock is initiliazed when watch thread starts.

Francois Cartegnie git at videolan.org
Thu Jul 19 14:23:24 CEST 2012


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jul 19 13:34:31 2012 +0200| [03fc36954474c52114868fd4378f2cdc9a2a79e4] | committer: Francois Cartegnie

ml: Ensure list lock is initiliazed when watch thread starts.

Some crashes occurs on start when processing the first append loop
at the unlock level.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=03fc36954474c52114868fd4378f2cdc9a2a79e4
---

 modules/media_library/ml_watch.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/media_library/ml_watch.c b/modules/media_library/ml_watch.c
index 960bccf..4a7da59 100644
--- a/modules/media_library/ml_watch.c
+++ b/modules/media_library/ml_watch.c
@@ -93,6 +93,11 @@ int watch_Init( media_library_t *p_ml )
     vlc_cond_init( &p_wt->cond );
     vlc_mutex_init( &p_wt->lock );
 
+    /* Initialise item append queue */
+    vlc_mutex_init( &p_wt->item_append_queue_lock );
+    p_wt->item_append_queue = NULL;
+    p_wt->item_append_queue_count = 0;
+
     if( vlc_clone( &p_wt->thread, watch_Thread, p_wt, VLC_THREAD_PRIORITY_LOW ) )
     {
         msg_Dbg( p_ml, "unable to launch the auto-updating thread" );
@@ -111,11 +116,6 @@ int watch_Init( media_library_t *p_ml )
     var_AddCallback( p_pl, "playlist-item-append", watch_PlaylistItemAppend, p_ml );
     var_AddCallback( p_pl, "playlist-item-deleted", watch_PlaylistItemDeleted, p_ml );
 
-    /* Initialise item append queue */
-    vlc_mutex_init( &p_wt->item_append_queue_lock );
-    p_wt->item_append_queue = NULL;
-    p_wt->item_append_queue_count = 0;
-
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list