summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-25 07:43:52 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-25 07:43:52 (GMT)
commit62da8564d257af381acb606e98fc712d87f7f5cb (patch)
tree97790b9c17d09f6e9e12722f7431a5408aa77184 /plugins
parentd0a287a4e57b299cec22c94b028e3553d5b36fcd (diff)
Released the Python global lock while waiting for an analysis.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysalide/analysis/loaded.c5
-rw-r--r--plugins/pychrysalide/arch/processor.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/plugins/pychrysalide/analysis/loaded.c b/plugins/pychrysalide/analysis/loaded.c
index 6801ec3..dd236ed 100644
--- a/plugins/pychrysalide/analysis/loaded.c
+++ b/plugins/pychrysalide/analysis/loaded.c
@@ -99,13 +99,18 @@ static PyObject *py_loaded_content_analyze(PyObject *self, PyObject *args)
static PyObject *py_loaded_content_analyze_and_wait(PyObject *self, PyObject *args)
{
PyObject *result; /* Bilan à retourner */
+ PyThreadState *_save; /* Sauvegarde de contexte */
GLoadedContent *content; /* Version GLib de l'élément */
bool status; /* Bilan de l'opération */
content = G_LOADED_CONTENT(pygobject_get(self));
+ Py_UNBLOCK_THREADS;
+
status = g_loaded_content_analyze_and_wait(content);
+ Py_BLOCK_THREADS;
+
result = status ? Py_True : Py_False;
Py_INCREF(result);
diff --git a/plugins/pychrysalide/arch/processor.c b/plugins/pychrysalide/arch/processor.c
index b59e59b..78109ee 100644
--- a/plugins/pychrysalide/arch/processor.c
+++ b/plugins/pychrysalide/arch/processor.c
@@ -321,12 +321,15 @@ static int py_arch_processor_init(PyObject *self, PyObject *args, PyObject *kwds
static GProcContext *py_arch_processor_get_context_wrapper(const GArchProcessor *proc)
{
GProcContext *result; /* Instance à retourner */
+ PyGILState_STATE gstate; /* Sauvegarde d'environnement */
PyObject *pyobj; /* Objet Python concerné */
PyObject *pyctx; /* Contexte en objet Python */
int ret; /* Bilan d'une conversion */
GArchProcessorClass *class; /* Classe de l'objet courant */
GArchProcessorClass *parent; /* Classe parente */
+ gstate = PyGILState_Ensure();
+
pyobj = pygobject_new(G_OBJECT(proc));
if (has_python_method(pyobj, "_get_context"))
@@ -363,6 +366,8 @@ static GProcContext *py_arch_processor_get_context_wrapper(const GArchProcessor
}
+ PyGILState_Release(gstate);
+
return result;
}
@@ -387,12 +392,15 @@ static GProcContext *py_arch_processor_get_context_wrapper(const GArchProcessor
static GArchInstruction *py_arch_processor_disassemble_wrapper(const GArchProcessor *proc, GProcContext *ctx, const GBinContent *content, vmpa2t *pos, GExeFormat *format)
{
GArchInstruction *result; /* Instance à retourner */
+ PyGILState_STATE gstate; /* Sauvegarde d'environnement */
PyObject *pyobj; /* Objet Python concerné */
PyObject *pypos; /* Position en objet Python */
PyObject *args; /* Arguments pour l'appel */
PyObject *pyins; /* Instruction en objet Python */
int ret; /* Bilan d'une conversion */
+ gstate = PyGILState_Ensure();
+
pyobj = pygobject_new(G_OBJECT(proc));
if (has_python_method(pyobj, "_disassemble"))
@@ -438,6 +446,8 @@ static GArchInstruction *py_arch_processor_disassemble_wrapper(const GArchProces
else
result = NULL;
+ PyGILState_Release(gstate);
+
return result;
}