subpicture_region_t * );
static char *FontConfig_Select( FcConfig *, const char *,
bool, bool, int * );
-static int BuildDone( vlc_object_t*, const char *, vlc_value_t, vlc_value_t,
- void* );
#endif
static void FontBuilderDetach( filter_t *p_filter, vlc_object_t *p_fontbuilder );
static void FontBuilderThread( vlc_object_t *p_this);
static void FontBuilderDestructor( vlc_object_t *p_this );
+static int FontBuilderDone( vlc_object_t*, const char *, vlc_value_t, vlc_value_t,
+ void* );
#endif
/*****************************************************************************
}
if( p_fontbuilder )
{
- var_AddCallback( p_fontbuilder, "build-done", BuildDone, p_filter );
+ var_AddCallback( p_fontbuilder, "build-done", FontBuilderDone, p_filter );
var_TriggerCallback( p_fontbuilder, "build-done" );
}
vlc_mutex_unlock( p_lock );
-
*pp_lock = p_lock;
return p_fontbuilder;
}
vlc_mutex_t *lock = var_AcquireMutex( "fontbuilder" );
if( p_fontbuilder )
{
- var_DelCallback( p_fontbuilder, "build-done", BuildDone, p_filter );
+ const bool b_alive = vlc_object_alive( p_fontbuilder );
+
+ var_DelCallback( p_fontbuilder, "build-done", FontBuilderDone, p_filter );
/* We wait for the thread on the first FontBuilderDetach */
- if( vlc_object_alive( p_fontbuilder ) )
+ if( b_alive )
{
vlc_object_kill( p_fontbuilder );
+ vlc_mutex_unlock( lock );
+
+ /* We need to unlock otherwise we may not join (the thread waiting
+ * for the lock). It is safe to unlock as no one else will try a
+ * join and we have a reference on the object) */
vlc_thread_join( p_fontbuilder );
+
+ vlc_mutex_lock( lock );
}
vlc_object_release( p_fontbuilder );
}
if( p_fontconfig )
FcConfigDestroy( p_fontconfig );
}
+static int FontBuilderDone( vlc_object_t *p_this, const char *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *param )
+{
+ filter_t *p_filter = param;
+ filter_sys_t *p_sys = p_filter->p_sys;
+
+ if( newval.b_bool )
+ {
+ vlc_mutex_t *p_lock = var_AcquireMutex( "fontbuilder" );
+
+ p_sys->b_fontconfig_ok = true;
+ p_sys->p_fontconfig = p_this->p_private;
+
+ vlc_mutex_unlock( p_lock );
+ }
+
+ VLC_UNUSED(psz_var);
+ VLC_UNUSED(oldval);
+ return VLC_SUCCESS;
+}
#endif
/*****************************************************************************
return VLC_EGENERIC;
}
-static int BuildDone( vlc_object_t *p_this, const char *psz_var,
- vlc_value_t oldval, vlc_value_t newval, void *param )
-{
- filter_t *p_filter = param;
- filter_sys_t *p_sys = p_filter->p_sys;
-
- if( newval.b_bool )
- {
- vlc_mutex_lock( p_sys->p_fontconfig_lock );
- p_sys->b_fontconfig_ok = true;
- p_sys->p_fontconfig = p_this->p_private;
- vlc_mutex_unlock( p_sys->p_fontconfig_lock );
- }
-
- VLC_UNUSED(psz_var);
- VLC_UNUSED(oldval);
- return VLC_SUCCESS;
-}
-
static int ProcessLines( filter_t *p_filter,
uint32_t *psz_text,
int i_len,