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.
This commit is contained in:
Jehan 2020-12-05 18:55:59 +01:00
parent 1ed87e2d17
commit cd6e777dcd
1 changed files with 17 additions and 9 deletions

View File

@ -325,8 +325,7 @@ debug_show_image_graph (GimpImage *source_image)
GimpImage *new_image; GimpImage *new_image;
GeglNode *introspect; GeglNode *introspect;
GeglNode *sink; GeglNode *sink;
GeglBuffer *buffer; GeglBuffer *buffer = NULL;
gchar *new_name;
image_graph = gimp_projectable_get_graph (GIMP_PROJECTABLE (source_image)); image_graph = gimp_projectable_get_graph (GIMP_PROJECTABLE (source_image));
@ -344,6 +343,15 @@ debug_show_image_graph (GimpImage *source_image)
gegl_node_link_many (introspect, sink, NULL); gegl_node_link_many (introspect, sink, NULL);
gegl_node_process (sink); gegl_node_process (sink);
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", new_name = g_strdup_printf ("%s GEGL graph",
gimp_image_get_display_name (source_image)); gimp_image_get_display_name (source_image));
@ -352,8 +360,8 @@ debug_show_image_graph (GimpImage *source_image)
gimp_image_set_file (new_image, g_file_new_for_uri (new_name)); gimp_image_set_file (new_image, g_file_new_for_uri (new_name));
g_free (new_name); g_free (new_name);
g_object_unref (buffer); g_object_unref (buffer);
}
g_object_unref (sink); g_object_unref (sink);
g_object_unref (introspect); g_object_unref (introspect);