summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/plugin.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-14 16:38:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-14 16:38:10 (GMT)
commit97fa09113c7988e4b4639190ba9bc51f9ced4d33 (patch)
tree1b4fe85843b4cdbf685e5116a96c4f387a865561 /plugins/pychrysalide/plugin.c
parente526727b94444030a3ae4dc6d4431cb72aea31e0 (diff)
Extended the Python API to build custom GUI panels.
Diffstat (limited to 'plugins/pychrysalide/plugin.c')
-rw-r--r--plugins/pychrysalide/plugin.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/pychrysalide/plugin.c b/plugins/pychrysalide/plugin.c
index 6b6060d..44f518e 100644
--- a/plugins/pychrysalide/plugin.c
+++ b/plugins/pychrysalide/plugin.c
@@ -586,8 +586,14 @@ static bool g_python_plugin_read_interface(GPythonPlugin *plugin)
static bool g_python_plugin_do_init(GPythonPlugin *plugin)
{
bool result; /* Bilan à retourner */
+ PyThreadState *tstate; /* Contexte d'environnement */
PyObject *value; /* Valeur obtenue */
+ tstate = PyThreadState_Get();
+
+ if (tstate != NULL)
+ PyEval_RestoreThread(tstate);
+
if (!has_python_method(plugin->instance, "init"))
result = true;
@@ -601,6 +607,9 @@ static bool g_python_plugin_do_init(GPythonPlugin *plugin)
}
+ if (tstate != NULL)
+ PyEval_SaveThread();
+
return result;
}