summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/format
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2022-08-18 19:05:33 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2022-08-18 19:05:33 (GMT)
commitf22f73bcbdb6510169c8b7c7c3fea842750c6fe5 (patch)
treec621257695d9f132dff88b9149ee86d3b0888236 /plugins/pychrysalide/format
parent429b54556283116a29c5d699af0cf891bb1c1055 (diff)
Handle the Python Global Interpreter Lock with more care.
Diffstat (limited to 'plugins/pychrysalide/format')
-rw-r--r--plugins/pychrysalide/format/symbol.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/pychrysalide/format/symbol.c b/plugins/pychrysalide/format/symbol.c
index e2f2dda..1559b9a 100644
--- a/plugins/pychrysalide/format/symbol.c
+++ b/plugins/pychrysalide/format/symbol.c
@@ -215,6 +215,7 @@ static void py_binary_symbol_init_gclass(GBinSymbolClass *class, gpointer unused
static char *py_binary_symbol_get_label_wrapper(const GBinSymbol *symbol)
{
char *result; /* Etiquette à retourner */
+ PyGILState_STATE gstate; /* Sauvegarde d'environnement */
PyObject *pyobj; /* Objet Python concerné */
PyObject *pyret; /* Bilan de consultation */
@@ -229,6 +230,8 @@ static char *py_binary_symbol_get_label_wrapper(const GBinSymbol *symbol)
result = NULL;
+ gstate = PyGILState_Ensure();
+
pyobj = pygobject_new(G_OBJECT(symbol));
if (has_python_method(pyobj, "_get_label"))
@@ -247,6 +250,8 @@ static char *py_binary_symbol_get_label_wrapper(const GBinSymbol *symbol)
Py_DECREF(pyobj);
+ PyGILState_Release(gstate);
+
return result;
}