Explorar el Código

UnInitialize python interp only if PyEval_ThreadsInitialized() is True

Jean-Christophe Fillion-Robin hace 14 años
padre
commit
d756526bbf
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp

+ 5 - 2
Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp

@@ -49,8 +49,11 @@ ctkAbstractPythonManager::ctkAbstractPythonManager(QObject* _parent) : Superclas
 //-----------------------------------------------------------------------------
 ctkAbstractPythonManager::~ctkAbstractPythonManager()
 {
-  PyThreadState* state = PyThreadState_Get();
-  Py_EndInterpreter(state);
+  if (PyEval_ThreadsInitialized())
+    {
+    PyThreadState* state = PyThreadState_Get();
+    Py_EndInterpreter(state);
+    }
   PythonQt::cleanup();
 }