[vlc-devel] commit: Fixed a potential freetype deadlock as var_AcquireMutex is not recursive : ( (Laurent Aimar )
git version control
git at videolan.org
Mon Aug 18 19:39:24 CEST 2008
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Aug 18 14:03:08 2008 +0200| [334c6a547f946940f7bee48d1f41283dccbcd483] | committer: Laurent Aimar
Fixed a potential freetype deadlock as var_AcquireMutex is not recursive :(
(It probably should have been called AquireLock then)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=334c6a547f946940f7bee48d1f41283dccbcd483
---
modules/misc/freetype.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index 57dbc9d..21e7d3a 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -247,6 +247,7 @@ static vlc_object_t *FontBuilderAttach( filter_t *p_filter, vlc_mutex_t **pp_loc
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 void FontBuilderGetFcConfig( filter_t *p_filter, vlc_object_t *p_fontbuilder );
static int FontBuilderDone( vlc_object_t*, const char *, vlc_value_t, vlc_value_t,
void* );
#endif
@@ -483,7 +484,7 @@ static vlc_object_t *FontBuilderAttach( filter_t *p_filter, vlc_mutex_t **pp_loc
if( p_fontbuilder )
{
var_AddCallback( p_fontbuilder, "build-done", FontBuilderDone, p_filter );
- var_TriggerCallback( p_fontbuilder, "build-done" );
+ FontBuilderGetFcConfig( p_filter, p_fontbuilder );
}
vlc_mutex_unlock( p_lock );
*pp_lock = p_lock;
@@ -550,6 +551,13 @@ static void* FontBuilderThread( vlc_object_t *p_this )
}
return NULL;
}
+static void FontBuilderGetFcConfig( filter_t *p_filter, vlc_object_t *p_fontbuilder )
+{
+ filter_sys_t *p_sys = p_filter->p_sys;
+
+ p_sys->p_fontconfig = p_fontbuilder->p_private;
+ p_sys->b_fontconfig_ok = p_fontbuilder->p_private != NULL;
+}
static void FontBuilderDestructor( vlc_object_t *p_this )
{
FcConfig *p_fontconfig = p_this->p_private;
@@ -561,14 +569,12 @@ 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;
+ FontBuilderGetFcConfig( p_filter, p_this );
vlc_mutex_unlock( p_lock );
}
More information about the vlc-devel
mailing list