gimp/33ab56f55406cc3cbe3cc7c0627340da1c1f2d6a.patch
Adrian Schröter 13e926c752 - drop buildrequires for the font. really not needed.
- scm scripts seems to also require the typelib for gimp. move the
  typelib to the main package including the requires for the
  babl/gegl typelibs

- Added 33ab56f55406cc3cbe3cc7c0627340da1c1f2d6a.patch 
  This properly fixes that gimp doesnt crash if it doesnt find any
  fonts. 
- guard the gdb buildrequires in a bcond debug_in_build_gimp so we
  can easily reenable it for future issues
- replace bitstream-vera-fonts with google-noto-sans-fonts
  The actual font it looks for is "Warsaw Gothic" but according to
  https://gitlab.gnome.org/GNOME/gimp/-/issues/12640#note_2312400
  it should not really need it during the build

- Sync spec file with master package
  - add libbacktrace-devel for better backtrace support
  - add BR for bitstream-vera-fonts so that at least some fonts
    are available for the splash screen. this fixes the build
    crash.
- cleanup lua BR as the lua plugin is experimental and shouldnt be
  enabled.

- Add gdb.patch and gdb BR to debug
  https://gitlab.gnome.org/GNOME/gimp/-/issues/12640

- Import some useful patches from Fedora 
  gimp-2.99.19-cm-system-monitor-profile-by-default.patch
  gimp-2.99.19-external-help-browser.patch

OBS-URL: https://build.opensuse.org/package/show/graphics/gimp?expand=0&rev=79
2025-01-14 08:52:56 +00:00

55 lines
2.5 KiB
Diff

From 33ab56f55406cc3cbe3cc7c0627340da1c1f2d6a Mon Sep 17 00:00:00 2001
From: Jehan <jehan@girinstud.io>
Date: Tue, 7 Jan 2025 12:34:20 +0100
Subject: [PATCH] Issue #12640: crash on font not found.
pango_context_load_font() can return NULL.
---
app/text/gimpfont.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/app/text/gimpfont.c b/app/text/gimpfont.c
index 0db776164b..b8559bfe47 100644
--- a/app/text/gimpfont.c
+++ b/app/text/gimpfont.c
@@ -285,10 +285,13 @@ gimp_font_deserialize_create (GType type,
context = pango_font_map_create_context (fontmap);
pfd = pango_font_description_from_string (font_name);
fc_font = PANGO_FC_FONT (pango_context_load_font (context, pfd));
- fc_pattern = pango_fc_font_get_pattern (fc_font);
- FcPatternGetString (fc_pattern, FC_FULLNAME, 0, (FcChar8 **) &fullname);
- FcPatternGetString (fc_pattern, FC_FILE, 0, (FcChar8 **) &file_path);
- FcPatternGetString (fc_pattern, FC_POSTSCRIPT_NAME, 0, (FcChar8 **) &psname);
+ if (fc_font != NULL)
+ {
+ fc_pattern = pango_fc_font_get_pattern (fc_font);
+ FcPatternGetString (fc_pattern, FC_FULLNAME, 0, (FcChar8 **) &fullname);
+ FcPatternGetString (fc_pattern, FC_FILE, 0, (FcChar8 **) &file_path);
+ FcPatternGetString (fc_pattern, FC_POSTSCRIPT_NAME, 0, (FcChar8 **) &psname);
+ }
}
/* If a font's pfd matches a font's pfd or the pfd matches name+style then done.
* Otherwise, use the pfd to retrieve a font file name & psname & fullname, and match with that
@@ -302,7 +305,8 @@ gimp_font_deserialize_create (GType type,
!g_strcmp0 (font->fullname, font_name) ||
!g_strcmp0 (font->family_style_concat, font_name))
break;
- else if (!g_strcmp0 (font->file_path, file_path) &&
+ else if (fc_font != NULL &&
+ !g_strcmp0 (font->file_path, file_path) &&
(!g_strcmp0 (font->psname, psname) || !g_strcmp0 (font->fullname, fullname)))
possible_match = font;
@@ -321,7 +325,7 @@ gimp_font_deserialize_create (GType type,
{
g_object_unref (fontmap);
g_object_unref (context);
- g_object_unref (fc_font);
+ g_clear_object (&fc_font);
g_free (font_name);
}
--
GitLab