[gimp] Bug 795650 - Gimp crashes on start in Windows.



commit d58f131b59346964171192407f3470dcadc5ecc7
Author: Jehan <jehan girinstud io>
Date:   Sat May 5 15:10:01 2018 +0200

    Bug 795650 - Gimp crashes on start in Windows.
    
    Add more assertion checks (similar to commit d094ab7e56).
    
    This is still not a fix per-se, but at least would make the code a bit
    more robust. In particular FcObjectSetDestroy() could crash if somehow
    FcObjectSetBuild() had returned a NULL pointer. And obviously
    dereferencing a NULL fontset would crash as well.
    Now if any of these happened, no fonts would be loaded. But at least
    GIMP would not crash.

 app/text/gimpfontlist.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/app/text/gimpfontlist.c b/app/text/gimpfontlist.c
index 649bb75..7491fcd 100644
--- a/app/text/gimpfontlist.c
+++ b/app/text/gimpfontlist.c
@@ -207,14 +207,23 @@ gimp_font_list_load_names (GimpFontList *list,
   os = FcObjectSetBuild (FC_FAMILY, FC_STYLE,
                          FC_SLANT, FC_WEIGHT, FC_WIDTH,
                          NULL);
+  g_return_if_fail (os);
 
   pat = FcPatternCreate ();
+  if (! pat)
+    {
+      FcObjectSetDestroy (os);
+      g_critical ("%s: FcPatternCreate() returned NULL.", G_STRFUNC);
+      return;
+    }
 
   fontset = FcFontList (NULL, pat, os);
 
   FcPatternDestroy (pat);
   FcObjectSetDestroy (os);
 
+  g_return_if_fail (fontset);
+
   for (i = 0; i < fontset->nfont; i++)
     {
       PangoFontDescription *desc;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]