libgimp: add gimp_plug_in_info_set_callbacks().

This is an alternative way to set up a plug-in callbacks, apart from
setting directly the PlugInInfo struct properties.
The reason is that setting directly the Gimp*Proc properties crashes the
plug-in, when done through the Python GI binding.

It is most likely a bug in Pygobject, unless we need the proper
annotation (which I haven't found yet). See:
https://gitlab.gnome.org/GNOME/pygobject/issues/24#note_564968

Setting these callbacks from the C code works fine though, hence this
new API. It is to be noted that the '(scope async)' is the most
important part in this function annotations. Without these annotations,
the function pointers become invalid at the end of the set_callbacks()
call, hence the plug-in crashes when they are actually called.

Unfortunally I am also notified by ebassi that using (scope) at all (any
of the 3 possible values) is just wrong. An API change will be
necessary. For the time being, I leave this like this, for the sake of
testing further, but we'll need to improve things.
This commit is contained in:
Jehan
2019-07-25 15:17:33 +02:00
parent 8aaf517db4
commit febc1a843d
2 changed files with 30 additions and 0 deletions

View File

@ -234,6 +234,12 @@ struct _GimpParam
#endif
void gimp_plug_in_info_set_callbacks (GimpPlugInInfo *info,
GimpInitProc init_proc,
GimpQuitProc quit_proc,
GimpQueryProc query_proc,
GimpRunProc run_proc);
/* The main procedure that must be called with the PLUG_IN_INFO structure
* and the 'argc' and 'argv' that are passed to "main".
*/