From: John Spray Date: Wed, 29 Mar 2017 17:31:49 +0000 (-0400) Subject: mgr: fix MgrPyModule destruction X-Git-Tag: v12.0.3~305^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4c59fedb482ad5b19bb15a3b503cf6f8688eb31f;p=ceph.git mgr: fix MgrPyModule destruction Fixes: http://tracker.ceph.com/issues/19412 Signed-off-by: John Spray --- diff --git a/src/mgr/MgrPyModule.cc b/src/mgr/MgrPyModule.cc index 4e4c42483a51..fe2a8436fb45 100644 --- a/src/mgr/MgrPyModule.cc +++ b/src/mgr/MgrPyModule.cc @@ -31,9 +31,14 @@ MgrPyModule::MgrPyModule(const std::string &module_name_) MgrPyModule::~MgrPyModule() { - Py_XDECREF(pModule); - Py_XDECREF(pClass); + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + Py_XDECREF(pClassInstance); + Py_XDECREF(pClass); + Py_XDECREF(pModule); + + PyGILState_Release(gstate); } int MgrPyModule::load()