From 528cd1905a29dad22880fa9a5a43241293d61994 Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 10 Dec 2025 01:05:16 +0100 Subject: [PATCH] app, pdb: initialize the "config" object for custom GIMP operations. If the config object is NULL, we later face crashes! My guess is that we had only been testing editing custom ops, but not creating them from public API! --- app/pdb/drawable-filter-cmds.c | 11 +++++++++++ pdb/groups/drawable_filter.pdb | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/app/pdb/drawable-filter-cmds.c b/app/pdb/drawable-filter-cmds.c index c6cfe11ab6..75592ac1af 100644 --- a/app/pdb/drawable-filter-cmds.c +++ b/app/pdb/drawable-filter-cmds.c @@ -165,6 +165,17 @@ drawable_filter_new_invoker (GimpProcedure *procedure, gegl_node_set (operation, "operation", operation_name, NULL); + if (gimp_operation_config_is_custom (gimp, operation_name)) + { + GParamSpec *pspec = gegl_node_find_property (operation, "config"); + GType otype = pspec->value_type; + GObject *config = g_object_new (otype, NULL); + + gegl_node_set (operation, "config", config, NULL); + + g_object_unref (config); + } + filter = gimp_drawable_filter_new (drawable, name, operation, NULL); /* We don't have a libgimp function for setting the clipping * behavior. I want to look further into the whole logic first. diff --git a/pdb/groups/drawable_filter.pdb b/pdb/groups/drawable_filter.pdb index e8201d07ce..8cda729c1e 100644 --- a/pdb/groups/drawable_filter.pdb +++ b/pdb/groups/drawable_filter.pdb @@ -82,6 +82,17 @@ HELP gegl_node_set (operation, "operation", operation_name, NULL); + if (gimp_operation_config_is_custom (gimp, operation_name)) + { + GParamSpec *pspec = gegl_node_find_property (operation, "config"); + GType otype = pspec->value_type; + GObject *config = g_object_new (otype, NULL); + + gegl_node_set (operation, "config", config, NULL); + + g_object_unref (config); + } + filter = gimp_drawable_filter_new (drawable, name, operation, NULL); /* We don't have a libgimp function for setting the clipping * behavior. I want to look further into the whole logic first.