fix possible crash in destructor of FeaturePythonPyT template

This commit is contained in:
wmayer
2017-01-21 13:25:26 +01:00
parent c10f6fdd07
commit b09ea956fc
2 changed files with 3 additions and 0 deletions

View File

@@ -24,6 +24,7 @@
#define APP_FEATUREPYTHONPYIMP_H
#include <Base/BaseClass.h>
#include <Base/Interpreter.h>
#include <App/PropertyContainerPy.h>
#define PYTHON_TYPE_DEF(_class_, _subclass_) \

View File

@@ -84,12 +84,14 @@ template<class FeaturePyT>
FeaturePythonPyT<FeaturePyT>::FeaturePythonPyT(Base::BaseClass *pcObject, PyTypeObject *T)
: FeaturePyT(reinterpret_cast<typename FeaturePyT::PointerType>(pcObject), T)
{
Base::PyGILStateLocker lock;
dict_methods = PyDict_New();
}
template<class FeaturePyT>
FeaturePythonPyT<FeaturePyT>::~FeaturePythonPyT()
{
Base::PyGILStateLocker lock;
Py_DECREF(dict_methods);
}