From b09ea956fc070987d0d7f3dca617edd81ba77d59 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 21 Jan 2017 13:25:26 +0100 Subject: [PATCH] fix possible crash in destructor of FeaturePythonPyT template --- src/App/FeaturePythonPyImp.h | 1 + src/App/FeaturePythonPyImp.inl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/App/FeaturePythonPyImp.h b/src/App/FeaturePythonPyImp.h index 3926bfff7a..d040ea01b6 100644 --- a/src/App/FeaturePythonPyImp.h +++ b/src/App/FeaturePythonPyImp.h @@ -24,6 +24,7 @@ #define APP_FEATUREPYTHONPYIMP_H #include +#include #include #define PYTHON_TYPE_DEF(_class_, _subclass_) \ diff --git a/src/App/FeaturePythonPyImp.inl b/src/App/FeaturePythonPyImp.inl index a71e476066..cc6e2acffc 100644 --- a/src/App/FeaturePythonPyImp.inl +++ b/src/App/FeaturePythonPyImp.inl @@ -84,12 +84,14 @@ template FeaturePythonPyT::FeaturePythonPyT(Base::BaseClass *pcObject, PyTypeObject *T) : FeaturePyT(reinterpret_cast(pcObject), T) { + Base::PyGILStateLocker lock; dict_methods = PyDict_New(); } template FeaturePythonPyT::~FeaturePythonPyT() { + Base::PyGILStateLocker lock; Py_DECREF(dict_methods); }