Skip to content

Commit 2feb87e

Browse files
committed
avoid infinite loop when release calls module unload which calls release...
1 parent 02c3ee9 commit 2feb87e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Plugin/src/SofaPython3/PythonEnvironment.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,10 @@ void PythonEnvironment::Release()
324324
{
325325
/// Finish the Python Interpreter
326326
/// obviously can't use raii here
327-
if( Py_IsInitialized() ) {
327+
static bool isReleased = false;
328+
if( Py_IsInitialized() && !isReleased) {
329+
isReleased = true;
330+
328331
PyGILState_Ensure();
329332
py::finalize_interpreter();
330333
getStaticData()->reset();

0 commit comments

Comments
 (0)