Check if the interpreter still exists before trying to acquire the GIL

This commit is contained in:
Robin Dunn
2019-06-29 11:22:14 -07:00
parent c90357e787
commit 783ce37252

View File

@@ -6101,14 +6101,14 @@ void sip_api_instance_destroyed(sipSimpleWrapper *sw)
*/ */
static void sip_api_instance_destroyed_ex(sipSimpleWrapper **sipSelfp) static void sip_api_instance_destroyed_ex(sipSimpleWrapper **sipSelfp)
{ {
SIP_BLOCK_THREADS
sipSimpleWrapper *sipSelf = *sipSelfp; sipSimpleWrapper *sipSelf = *sipSelfp;
if (sipSelf != NULL && sipInterpreter != NULL) if (sipSelf != NULL && sipInterpreter != NULL)
{ {
PyObject *xtype, *xvalue, *xtb; PyObject *xtype, *xvalue, *xtb;
SIP_BLOCK_THREADS
/* We may be tidying up after an exception so preserve it. */ /* We may be tidying up after an exception so preserve it. */
PyErr_Fetch(&xtype, &xvalue, &xtb); PyErr_Fetch(&xtype, &xvalue, &xtb);
callPyDtor(sipSelf); callPyDtor(sipSelf);
@@ -6136,6 +6136,8 @@ static void sip_api_instance_destroyed_ex(sipSimpleWrapper **sipSelfp)
{ {
removeFromParent((sipWrapper *)sipSelf); removeFromParent((sipWrapper *)sipSelf);
} }
SIP_UNBLOCK_THREADS
} }
/* /*
@@ -6145,8 +6147,6 @@ static void sip_api_instance_destroyed_ex(sipSimpleWrapper **sipSelfp)
* reimplemented virtuals. * reimplemented virtuals.
*/ */
*sipSelfp = NULL; *sipSelfp = NULL;
SIP_UNBLOCK_THREADS
} }