Alpha mask: thread-safety
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 19 May 2009 16:49:37 +0000 (19:49 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 19 May 2009 17:59:05 +0000 (20:59 +0300)
A corner case occured if the mask were changed during initialization.

modules/video_filter/alphamask.c

index 79999cd..af46bd7 100644 (file)
@@ -108,11 +108,6 @@ static int Create( vlc_object_t *p_this )
     config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
 
-    vlc_mutex_init( &p_sys->mask_lock );
-    psz_string =
-        var_CreateGetStringCommand( p_filter, CFG_PREFIX "mask" );
-    var_AddCallback( p_filter, CFG_PREFIX "mask", MaskCallback,
-                     p_filter );
     p_sys->p_mask = NULL;
     if( psz_string && *psz_string )
     {
@@ -123,6 +118,11 @@ static int Create( vlc_object_t *p_this )
     }
     free( psz_string );
 
+    vlc_mutex_init( &p_sys->mask_lock );
+    psz_string =
+        var_CreateGetStringCommand( p_filter, CFG_PREFIX "mask" );
+    var_AddCallback( p_filter, CFG_PREFIX "mask", MaskCallback,
+                     p_filter );
     p_filter->pf_video_filter = Filter;
 
     return VLC_SUCCESS;