fonts: linking #7

Huw D M Davies h.davies1 at physics.ox.ac.uk
Wed Sep 14 05:11:23 CDT 2005


        Huw Davies <huw at codeweavers.com>
        Cope with OpenFontFile failing.        
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/gdi/freetype.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/freetype.c,v
retrieving revision 1.99
diff -u -p -r1.99 freetype.c
--- dlls/gdi/freetype.c	12 Sep 2005 22:07:53 -0000	1.99
+++ dlls/gdi/freetype.c	14 Sep 2005 10:08:44 -0000
@@ -1605,11 +1605,14 @@ static void free_font(GdiFont font)
         struct list *first_hfont;
         HFONTLIST *hfontlist;
         list_remove(cursor);
-        first_hfont = list_head(&child->font->hfontlist);
-        hfontlist = LIST_ENTRY(first_hfont, HFONTLIST, entry);
-        DeleteObject(hfontlist->hfont);
-        HeapFree(GetProcessHeap(), 0, hfontlist);
-        free_font(child->font);
+        if(child->font)
+        {
+            first_hfont = list_head(&child->font->hfontlist);
+            hfontlist = LIST_ENTRY(first_hfont, HFONTLIST, entry);
+            DeleteObject(hfontlist->hfont);
+            HeapFree(GetProcessHeap(), 0, hfontlist);
+            free_font(child->font);
+        }
         HeapFree(GetProcessHeap(), 0, child->file_name);
         HeapFree(GetProcessHeap(), 0, child);
     }
@@ -3292,7 +3295,11 @@ static BOOL load_child_font(GdiFont font
     child->font = alloc_font();
     child->font->ft_face = OpenFontFile(child->font, child->file_name, child->index, 0, -font->ppem);
     if(!child->font->ft_face)
+    {
+        free_font(child->font);
+        child->font = NULL;
         return FALSE;
+    }
 
     child->font->orientation = font->orientation;
     hfontlist = HeapAlloc(GetProcessHeap(), 0, sizeof(*hfontlist));



More information about the wine-patches mailing list