fix crash with Py3 when releasing memory buffer

This commit is contained in:
wmayer
2018-10-27 19:58:54 +02:00
parent 3b1e1f8859
commit b6712e264a
2 changed files with 2 additions and 0 deletions

View File

@@ -1293,6 +1293,7 @@ Document::~Document()
// not to dec'ref the Python object any more.
// But we must still invalidate the Python object because it doesn't need to be
// destructed right now because the interpreter can own several references to it.
Base::PyGILStateLocker lock;
Base::PyObjectBase* doc = (Base::PyObjectBase*)DocumentPythonObject.ptr();
// Call before decrementing the reference counter, otherwise a heap error can occur
doc->setInvalid();