Skip to content

Commit 4a73d00

Browse files
committed
Moved PyGILState_Ensure in srd_decoder_inst to before PyTuple_New is called. Fixes segmentation fault
1 parent 26db5b2 commit 4a73d00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libsigrokdecode4DSL/instance.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,8 @@ SRD_API struct srd_decoder_inst *srd_inst_new(struct srd_session *sess,
370370
}
371371
}
372372

373+
gstate = PyGILState_Ensure();
374+
373375
/*
374376
* Prepare a default channel map, where samples come in the
375377
* 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,
389391
/* Default to the initial pins being the same as in sample 0. */
390392
oldpins_array_seed(di);
391393

392-
gstate = PyGILState_Ensure();
393-
394394
/* Create a new instance of this decoder class. */
395395
if (!(di->py_inst = PyObject_CallObject(dec->py_dec, NULL))) {
396396
if (PyErr_Occurred())

0 commit comments

Comments
 (0)