mirror of https://github.com/Icinga/icinga2.git
Bugfixes: Finalizing the interpreter might crash.
This commit is contained in:
parent
d4afb4087d
commit
413f81c29d
|
@ -29,11 +29,11 @@ PythonInterpreter::PythonInterpreter(const PythonLanguage::Ptr& language, const
|
|||
PyInterpreterState *interp = m_Language->GetMainThreadState()->interp;
|
||||
m_ThreadState = PyThreadState_New(interp);
|
||||
|
||||
PyEval_ReleaseLock();
|
||||
|
||||
PyEval_AcquireThread(m_ThreadState);
|
||||
(void) PyThreadState_Swap(m_ThreadState);
|
||||
PyRun_SimpleString(script->GetCode().CStr());
|
||||
PyEval_ReleaseThread(m_ThreadState);
|
||||
(void) PyThreadState_Swap(m_Language->GetMainThreadState());
|
||||
|
||||
PyEval_ReleaseLock();
|
||||
}
|
||||
|
||||
PythonInterpreter::~PythonInterpreter(void)
|
||||
|
|
|
@ -40,7 +40,9 @@ PythonLanguage::PythonLanguage(void)
|
|||
|
||||
PythonLanguage::~PythonLanguage(void)
|
||||
{
|
||||
Py_Finalize();
|
||||
/* Due to how we're destructing objects it might not be safe to
|
||||
* call Py_Finalize() when the Icinga instance is being shut
|
||||
* down - so don't bother calling it. */
|
||||
}
|
||||
|
||||
ScriptInterpreter::Ptr PythonLanguage::CreateInterpreter(const Script::Ptr& script)
|
||||
|
|
Loading…
Reference in New Issue