[gimp] libgimp: add gimp_plug_in_info_set_callbacks().
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: add gimp_plug_in_info_set_callbacks().
- Date: Thu, 25 Jul 2019 14:23:19 +0000 (UTC)
commit febc1a843d23566e86696d9996d166d21a1524c8
Author: Jehan <jehan girinstud io>
Date: Thu Jul 25 15:17:33 2019 +0200
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.
libgimp/gimp.c | 24 ++++++++++++++++++++++++
libgimp/gimp.h | 6 ++++++
2 files changed, 30 insertions(+)
---
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index 375f405706..025485db08 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -256,6 +256,30 @@ static GimpPDBStatusType pdb_error_status = GIMP_PDB_SUCCESS;
static gchar *pdb_error_message = NULL;
+/**
+ * gimp_plug_in_info_set_callbacks:
+ * @info: the PLUG_IN_INFO structure
+ * @init_proc: (closure) (scope async) (nullable): the init procedure
+ * @quit_proc: (closure) (scope async) (nullable): the quit procedure
+ * @query_proc: (closure) (scope async) (nullable): the query procedure
+ * @run_proc: (closure) (scope async) (nullable): the run procedure
+ *
+ * The procedure that must be called with the PLUG_IN_INFO structure to
+ * set the initialization, query, run and quit callbacks.
+ **/
+void
+gimp_plug_in_info_set_callbacks (GimpPlugInInfo *info,
+ GimpInitProc init_proc,
+ GimpQuitProc quit_proc,
+ GimpQueryProc query_proc,
+ GimpRunProc run_proc)
+{
+ info->init_proc = init_proc;
+ info->quit_proc = quit_proc;
+ info->query_proc = query_proc;
+ info->run_proc = run_proc;
+}
+
/**
* gimp_main:
* @info: the PLUG_IN_INFO structure
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index 13df071e67..346c6814d5 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -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".
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]