2.99 Throws GIMP-CRITICAL when emitting signal for plugin add menu branch, patch attached
GIMP version: master, yesterday's commit 9893f60d
Operating System: Ubuntu 20.10
Package: self-built, meson build
Description of the bug
Console shows:
> GIMP-CRITICAL: gimp_marshal_VOID__OBJECT_STRING_STRING: assertion 'n_param_values == 4' failed
and gimp dialog shows a backtrace (for a crashed plugin?)
Reproduction
Is the bug reproducible? Always
Reproduction steps:
No simple case, I use my test suite that exercises the PDB.
I am not sure the issue really is critical (has any effect on normal users.) I export GIMP_PLUGIN_DEBUG=all,fatal-criticals
Additional information
A snippet of the backtrace:
#4 0x0000556617bb3b6f in gimp_message_log_func (log_domain=0x55661820d755 "Gimp-Core", flags=G_LOG_LEVEL_CRITICAL, message=0x55661d752100 "gimp_marshal_VOID__OBJECT_STRING_STRING: assertion 'n_param_values == 4' failed", data=0x556618e6c3d0) at ../app/errors.c:263
gimp = 0x556618e6c3d0
config = 0x556618eefc10
msg_domain = 0x0
severity = GIMP_MESSAGE_BUG_CRITICAL
gui_message = 1
debug_policy = GIMP_DEBUG_POLICY_WARNING
#5 0x00007f71d69dbb79 in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#6 0x00007f71d69dbe13 in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#7 0x0000556617d6d344 in gimp_marshal_VOID__OBJECT_STRING_STRING (closure=0x55661af9d3d0, return_value=0x0, n_param_values=2, param_values=0x7ffc91e00ed0, invocation_hint=0x7ffc91e00e50, marshal_data=0x0) at app/core/gimpmarshal.c:1160
cc = 0x55661af9d3d0
data1 = 0x556600110002
data2 = 0x7ffc91e00e60
callback = 0x7f71d6ace769 <g_object_ref+89>
__func__ = "gimp_marshal_VOID__OBJECT_STRING_STRING"
#8 0x00007f71d6ac98fa in g_closure_invoke () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9 0x00007f71d6adc4b3 in () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007f71d6ae2c41 in g_signal_emit_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
See attached patch, which I now discuss.
In app/plug-in/gimppluginmanager.c at line 105, error at line 113, the '1':
manager_signals[MENU_BRANCH_ADDED] =
g_signal_new ("menu-branch-added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GimpPlugInManagerClass,
menu_branch_added),
NULL, NULL,
gimp_marshal_VOID__OBJECT_STRING_STRING,
G_TYPE_NONE, 1,
G_TYPE_FILE,
G_TYPE_STRING,
G_TYPE_STRING);
On the face of it, this is wrong, since the value '1' is given for the 'num_params' argument to g_signal_new, but it should be '3' since three arguments follow. I could be wrong, I have little experience with glib or the gimp/app code.
That code was last touched 15 years ago, makes me wonder: if no one has experienced it yet, how could it be critical?
I did test the patch, it seems to work.
0002-GIMP-CRITICAL-gimp_marshal_VOID__OBJECT_STRING_STRIN.patch