Skip to content

Commit

Permalink
Core: Add missing Python interpreter locks
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterhijma authored and wwmayer committed Jul 16, 2024
1 parent f0024a8 commit 44387a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/App/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ recompute path. Also, it enables more complicated dependencies beyond trees.
#include <QCoreApplication>

#include <App/DocumentPy.h>
#include <Base/Interpreter.h>
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Base/FileInfo.h>
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Gui/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 44387a7

Please sign in to comment.