From 783ce37252ea8731f02cdc3b776f7323dd842af1 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 29 Jun 2019 11:22:14 -0700 Subject: [PATCH] Check if the interpreter still exists before trying to acquire the GIL --- sip/siplib/siplib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sip/siplib/siplib.c b/sip/siplib/siplib.c index 8ab622d5..db60870c 100644 --- a/sip/siplib/siplib.c +++ b/sip/siplib/siplib.c @@ -6101,14 +6101,14 @@ void sip_api_instance_destroyed(sipSimpleWrapper *sw) */ static void sip_api_instance_destroyed_ex(sipSimpleWrapper **sipSelfp) { - SIP_BLOCK_THREADS - sipSimpleWrapper *sipSelf = *sipSelfp; if (sipSelf != NULL && sipInterpreter != NULL) { PyObject *xtype, *xvalue, *xtb; + SIP_BLOCK_THREADS + /* We may be tidying up after an exception so preserve it. */ PyErr_Fetch(&xtype, &xvalue, &xtb); callPyDtor(sipSelf); @@ -6136,6 +6136,8 @@ static void sip_api_instance_destroyed_ex(sipSimpleWrapper **sipSelfp) { removeFromParent((sipWrapper *)sipSelf); } + + SIP_UNBLOCK_THREADS } /* @@ -6145,8 +6147,6 @@ static void sip_api_instance_destroyed_ex(sipSimpleWrapper **sipSelfp) * reimplemented virtuals. */ *sipSelfp = NULL; - - SIP_UNBLOCK_THREADS }