From 4c59fedb482ad5b19bb15a3b503cf6f8688eb31f Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 29 Mar 2017 13:31:49 -0400 Subject: [PATCH] mgr: fix MgrPyModule destruction Fixes: http://tracker.ceph.com/issues/19412 Signed-off-by: John Spray --- src/mgr/MgrPyModule.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mgr/MgrPyModule.cc b/src/mgr/MgrPyModule.cc index 4e4c42483a51b..fe2a8436fb459 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() -- 2.39.5