From: Konstantin Leontev Date: Wed, 30 Aug 2023 10:23:45 +0000 (+0100) Subject: [bos #37406][CEA] Fixed segfault in YACS_YacsRuntimeTest on UB22,FD36 and FD37 by... X-Git-Tag: emc2p_1.4.0-rc1~2^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Ftlpr%2F5%2Fhead;p=modules%2Fyacs.git [bos #37406][CEA] Fixed segfault in YACS_YacsRuntimeTest on UB22,FD36 and FD37 by acquiring and releasing the GIL. --- diff --git a/src/runtime/Test/runtimeTest.cxx b/src/runtime/Test/runtimeTest.cxx index 01fa8b123..f48e04418 100644 --- a/src/runtime/Test/runtimeTest.cxx +++ b/src/runtime/Test/runtimeTest.cxx @@ -1400,8 +1400,12 @@ void RuntimeTest::convertPorts() cAny <<= (CORBA::Double) d0; break; case 2: + { + PyGILState_STATE gstate = PyGILState_Ensure(); v = pAny = PyFloat_FromDouble(d0); + PyGILState_Release(gstate); break; + } case 3: { ostringstream os; @@ -1484,8 +1488,12 @@ void RuntimeTest::convertPorts() vAny->decrRef(); break; case 2: - Py_DECREF(pAny); + { + PyGILState_STATE gstate = PyGILState_Ensure(); + Py_XDECREF(pAny); + PyGILState_Release(gstate); break; + } default: break; }