core: Don't assume filter has single operation
Resolves #12719 and #12721
In b78f3dad
, we assume that a filter is being created for a
single operation. However, certain tools like Bucket Fill might
pass a GEGL Graph node instead. This causes the call to
gegl_node_get_gegl_operation () to return NULL, which then
crashes when we attempt to get the Operation Class.
This path verifies that we have a single operation before
attempting to go further with getting its class.
This commit is contained in:
@ -339,8 +339,8 @@ gimp_drawable_filter_new (GimpDrawable *drawable,
|
|||||||
GimpDrawableFilter *filter;
|
GimpDrawableFilter *filter;
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
GeglNode *node;
|
GeglNode *node;
|
||||||
GeglOperation *op;
|
GeglOperation *op = NULL;
|
||||||
GeglOperationClass *opclass;
|
GeglOperationClass *opclass = NULL;
|
||||||
gboolean custom_name = TRUE;
|
gboolean custom_name = TRUE;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||||
@ -348,6 +348,7 @@ gimp_drawable_filter_new (GimpDrawable *drawable,
|
|||||||
g_return_val_if_fail (gegl_node_has_pad (operation, "output"), NULL);
|
g_return_val_if_fail (gegl_node_has_pad (operation, "output"), NULL);
|
||||||
|
|
||||||
op = gegl_node_get_gegl_operation (operation);
|
op = gegl_node_get_gegl_operation (operation);
|
||||||
|
if (op != NULL)
|
||||||
opclass = GEGL_OPERATION_GET_CLASS (op);
|
opclass = GEGL_OPERATION_GET_CLASS (op);
|
||||||
|
|
||||||
if (undo_desc == NULL || strlen (undo_desc) == 0)
|
if (undo_desc == NULL || strlen (undo_desc) == 0)
|
||||||
@ -356,7 +357,8 @@ gimp_drawable_filter_new (GimpDrawable *drawable,
|
|||||||
custom_name = FALSE;
|
custom_name = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! g_strcmp0 (undo_desc, gegl_operation_class_get_key (opclass, "title")))
|
if (opclass &&
|
||||||
|
! g_strcmp0 (undo_desc, gegl_operation_class_get_key (opclass, "title")))
|
||||||
custom_name = FALSE;
|
custom_name = FALSE;
|
||||||
|
|
||||||
filter = g_object_new (GIMP_TYPE_DRAWABLE_FILTER,
|
filter = g_object_new (GIMP_TYPE_DRAWABLE_FILTER,
|
||||||
|
Reference in New Issue
Block a user