From 44387a793b062c60c8864ac564a9b2bcb3210fce Mon Sep 17 00:00:00 2001 From: Pieter Hijma Date: Wed, 10 Jul 2024 17:02:09 +0200 Subject: [PATCH] Core: Add missing Python interpreter locks --- src/App/Document.cpp | 2 ++ src/Gui/Document.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 5d8a170204..988803e236 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -83,6 +83,7 @@ recompute path. Also, it enables more complicated dependencies beyond trees. #include #include +#include #include #include #include @@ -793,6 +794,7 @@ Document::Document(const char* documentName) // Remark: We force the document Python object to own the DocumentPy instance, thus we don't // have to care about ref counting any more. d = new DocumentP; + Base::PyGILStateLocker lock; d->DocumentPythonObject = Py::Object(new DocumentPy(this), true); #ifdef FC_LOGUPDATECHAIN diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index e6f01ef63a..b6bdeb950f 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -220,6 +220,7 @@ Document::Document(App::Document* pcDocument,Application * app) // pointer to the python class // NOTE: As this Python object doesn't get returned to the interpreter we // mustn't increment it (Werner Jan-12-2006) + Base::PyGILStateLocker lock; _pcDocPy = new Gui::DocumentPy(this); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Document");