[vlc-devel] [RFC] freetype and video-title-show crashes

Bernie Purcell b.purcell at adbglobal.com
Wed Oct 3 02:54:50 CEST 2007


Hi Jean-Paul,

There isn't any technical need for the fontbuilder thread to be launched 
before the init of Freetype - they can go in either order, so I see no 
problem in applying your patch if it is fixing a problem.
I'm interested in why it could be creating a problem though. The 
Fontconfig and Freetype stuff should be separate and not touching each 
other, so it is probably something stupid that I'm doing in the 
FontBuilder thread. I am using msg_Dbg(), msg_Err() in this thread, and 
they pass through the filter object as the first argument (and the same 
vlc object is still in use in the other thread). Would that be doing it?

Bitmap



Jean-Paul Saman <jean-paul.saman at planet.nl> 
Sent by: vlc-devel-bounces at videolan.org
03/10/2007 07:18 AM
Please respond to
Mailing list for VLC media player developers <vlc-devel at videolan.org>


To
"'developer'" <vlc-devel at videolan.org>
cc

Subject
[vlc-devel] [RFC] freetype and video-title-show crashes






Several people have mentioned a crash when the meta-name is shown on 
start of the video. I believe it is due to loading of freetype2 text 
renderer when the fontpath doesn't exist.

The freetype module starts another thread called FontBuilder and 
depending on timing this creates a crash or works allright. The attached 
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.

However I don't think the solution as presented in this patch is the 
correct one. Can someone with more knowledge (or one of the original 
authors) of the freetype text-renderer module suggest a better way of 
fixing this.

One question comes to mind must the FontBuilder thread be ran first or 
must freetype be initialized and the font loaded first?

I hope for some helpfull comments.

gtz,
Jean-Paul Saman.
Index: modules/misc/freetype.c
===================================================================
--- modules/misc/freetype.c              (revision 22367)
+++ modules/misc/freetype.c              (working copy)
@@ -334,6 +334,25 @@
 #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;
+    }
+
 #ifdef HAVE_FONTCONFIG
     vlc_mutex_init( p_filter, &p_sys->fontconfig_lock );
     p_sys->b_fontconfig_ok = VLC_FALSE;
@@ -366,25 +385,6 @@
                             "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 )
     {
_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
http://mailman.videolan.org/listinfo/vlc-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20071003/9a9277b8/attachment.html>


More information about the vlc-devel mailing list