[gimp] Issue #6045: File > Debug > Show Image Graph == GIMP_Crash.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #6045: File > Debug > Show Image Graph == GIMP_Crash.
- Date: Sat, 5 Dec 2020 18:02:01 +0000 (UTC)
commit cd6e777dcda26fbff449d603248ac5fc953ded13
Author: Jehan <jehan girinstud io>
Date: Sat Dec 5 18:55:59 2020 +0100
Issue #6045: File > Debug > Show Image Graph == GIMP_Crash.
The issue has also been fixed on GEGL side (see commit 5ac40e3c3 in
GEGL), but since the fact that "gegl:introspect" relies on a runtime
tool (which is not the best thing), let's make an additional check
within GIMP to make sure we have a proper buffer as a result to
"gegl:introspect". Otherwise we might crash when trying to use this
NULL buffer.
app/actions/debug-commands.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c
index 03dbb6f4ac..fbcd24f80a 100644
--- a/app/actions/debug-commands.c
+++ b/app/actions/debug-commands.c
@@ -325,8 +325,7 @@ debug_show_image_graph (GimpImage *source_image)
GimpImage *new_image;
GeglNode *introspect;
GeglNode *sink;
- GeglBuffer *buffer;
- gchar *new_name;
+ GeglBuffer *buffer = NULL;
image_graph = gimp_projectable_get_graph (GIMP_PROJECTABLE (source_image));
@@ -344,16 +343,25 @@ debug_show_image_graph (GimpImage *source_image)
gegl_node_link_many (introspect, sink, NULL);
gegl_node_process (sink);
- new_name = g_strdup_printf ("%s GEGL graph",
- gimp_image_get_display_name (source_image));
-
- new_image = gimp_create_image_from_buffer (source_image->gimp,
- buffer, new_name);
- gimp_image_set_file (new_image, g_file_new_for_uri (new_name));
-
- g_free (new_name);
-
- g_object_unref (buffer);
+ if (buffer)
+ {
+ gchar *new_name;
+
+ /* This should not happen but "gegl:introspect" is a bit fickle as
+ * it uses an external binary `dot`. Prevent useless crashes.
+ * I don't output a warning when buffer is NULL because anyway
+ * GEGL will output one itself.
+ */
+ new_name = g_strdup_printf ("%s GEGL graph",
+ gimp_image_get_display_name (source_image));
+
+ new_image = gimp_create_image_from_buffer (source_image->gimp,
+ buffer, new_name);
+ gimp_image_set_file (new_image, g_file_new_for_uri (new_name));
+
+ g_free (new_name);
+ g_object_unref (buffer);
+ }
g_object_unref (sink);
g_object_unref (introspect);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]