Changeset e3206fdb39a95bb8ce3022119ef5ae9c6c2e706c

Show
Ignore:
Timestamp:
08/10/07 22:46:23 (1 year ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1191876383 +0000
git-parent:

[8e914de13f635dd9c05c63284c22adbaa2ba3800]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1191876383 +0000
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/misc/freetype.c

    r4f5d55c re3206fd  
    335335    } 
    336336 
     337    i_error = FT_Init_FreeType( &p_sys->p_library ); 
     338    if( i_error ) 
     339    { 
     340        msg_Err( p_filter, "couldn't initialize freetype" ); 
     341        goto error; 
     342    } 
     343    i_error = FT_New_Face( p_sys->p_library, psz_fontfile ? psz_fontfile : "", 
     344                           0, &p_sys->p_face ); 
     345    if( i_error == FT_Err_Unknown_File_Format ) 
     346    { 
     347        msg_Err( p_filter, "file %s have unknown format", psz_fontfile ); 
     348        goto error; 
     349    } 
     350    else if( i_error ) 
     351    { 
     352        msg_Err( p_filter, "failed to load font file %s", psz_fontfile ); 
     353        goto error; 
     354    } 
     355 
     356    i_error = FT_Select_Charmap( p_sys->p_face, ft_encoding_unicode ); 
     357    if( i_error ) 
     358    { 
     359        msg_Err( p_filter, "font has no unicode translation table" ); 
     360        goto error; 
     361    } 
     362 
    337363#ifdef HAVE_FONTCONFIG 
    338364    vlc_mutex_init( p_filter, &p_sys->fontconfig_lock ); 
     
    367393    } 
    368394#endif 
    369     i_error = FT_Init_FreeType( &p_sys->p_library ); 
    370     if( i_error ) 
    371     { 
    372         msg_Err( p_filter, "couldn't initialize freetype" ); 
    373         goto error; 
    374     } 
    375     i_error = FT_New_Face( p_sys->p_library, psz_fontfile ? psz_fontfile : "", 
    376                            0, &p_sys->p_face ); 
    377     if( i_error == FT_Err_Unknown_File_Format ) 
    378     { 
    379         msg_Err( p_filter, "file %s have unknown format", psz_fontfile ); 
    380         goto error; 
    381     } 
    382     else if( i_error ) 
    383     { 
    384         msg_Err( p_filter, "failed to load font file %s", psz_fontfile ); 
    385         goto error; 
    386     } 
    387  
    388     i_error = FT_Select_Charmap( p_sys->p_face, ft_encoding_unicode ); 
    389     if( i_error ) 
    390     { 
    391         msg_Err( p_filter, "font has no unicode translation table" ); 
    392         goto error; 
    393     } 
    394395 
    395396    p_sys->i_use_kerning = FT_HAS_KERNING( p_sys->p_face );