From 4a73d00967219368926a089c0eb3598e4b811f55 Mon Sep 17 00:00:00 2001 From: Electro707 Date: Tue, 8 Dec 2020 18:11:14 -0500 Subject: [PATCH] Moved PyGILState_Ensure in srd_decoder_inst to before PyTuple_New is called. Fixes segmentation fault --- libsigrokdecode4DSL/instance.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsigrokdecode4DSL/instance.c b/libsigrokdecode4DSL/instance.c index 5ede7107..5d96701f 100755 --- a/libsigrokdecode4DSL/instance.c +++ b/libsigrokdecode4DSL/instance.c @@ -370,6 +370,8 @@ SRD_API struct srd_decoder_inst *srd_inst_new(struct srd_session *sess, } } + gstate = PyGILState_Ensure(); + /* * Prepare a default channel map, where samples come in the * order in which the decoder class defined them. @@ -389,8 +391,6 @@ SRD_API struct srd_decoder_inst *srd_inst_new(struct srd_session *sess, /* Default to the initial pins being the same as in sample 0. */ oldpins_array_seed(di); - gstate = PyGILState_Ensure(); - /* Create a new instance of this decoder class. */ if (!(di->py_inst = PyObject_CallObject(dec->py_dec, NULL))) { if (PyErr_Occurred())