Commit e3206fdb authored by Jean-Paul Saman's avatar Jean-Paul Saman

Run FontBuilder thread after Freetype has been initialized and no error paths...

Run FontBuilder thread after Freetype has been initialized and no error paths are can be taken. This should solve the crash reported by several people with the video title (or meta-name) appearing at start of the movie.

The freetype module starts another thread called FontBuilder and depending on timing this creates a crash or works allright. The crash is triggered by the font not being found. This patch tries to load the font first before the FontBuilder thread is started.

I was unable to reproduce the crash with the patch applied. Without the patch the crash is reproducable.

As discussed on the mailinglist the FontBuilder thread doesn't depend on the freetype initialisation and rearanging the order should do no harm.
parent 8e914de1
......@@ -334,6 +334,32 @@ static int Create( vlc_object_t *p_this )
#endif
}
i_error = FT_Init_FreeType( &p_sys->p_library );
if( i_error )
{
msg_Err( p_filter, "couldn't initialize freetype" );
goto error;
}
i_error = FT_New_Face( p_sys->p_library, psz_fontfile ? psz_fontfile : "",
0, &p_sys->p_face );
if( i_error == FT_Err_Unknown_File_Format )
{
msg_Err( p_filter, "file %s have unknown format", psz_fontfile );
goto error;
}
else if( i_error )
{
msg_Err( p_filter, "failed to load font file %s", psz_fontfile );
goto error;
}
i_error = FT_Select_Charmap( p_sys->p_face, ft_encoding_unicode );
if( i_error )
{
msg_Err( p_filter, "font has no unicode translation table" );
goto error;
}
#ifdef HAVE_FONTCONFIG
vlc_mutex_init( p_filter, &p_sys->fontconfig_lock );
p_sys->b_fontconfig_ok = VLC_FALSE;
......@@ -366,31 +392,6 @@ static int Create( vlc_object_t *p_this )
"Font styling won't be available." );
}
#endif
i_error = FT_Init_FreeType( &p_sys->p_library );
if( i_error )
{
msg_Err( p_filter, "couldn't initialize freetype" );
goto error;
}
i_error = FT_New_Face( p_sys->p_library, psz_fontfile ? psz_fontfile : "",
0, &p_sys->p_face );
if( i_error == FT_Err_Unknown_File_Format )
{
msg_Err( p_filter, "file %s have unknown format", psz_fontfile );
goto error;
}
else if( i_error )
{
msg_Err( p_filter, "failed to load font file %s", psz_fontfile );
goto error;
}
i_error = FT_Select_Charmap( p_sys->p_face, ft_encoding_unicode );
if( i_error )
{
msg_Err( p_filter, "font has no unicode translation table" );
goto error;
}
p_sys->i_use_kerning = FT_HAS_KERNING( p_sys->p_face );
......
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