From 902462a98792a98a08d1f242d6dde9869d96ccee Mon Sep 17 00:00:00 2001 From: chukobyte Date: Mon, 7 Jun 2021 13:25:24 -0400 Subject: [PATCH] Added explicit GIL releasing. --- src/core/scripting/python/python_script_context.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/scripting/python/python_script_context.h b/src/core/scripting/python/python_script_context.h index 207bf182..6ce1a43d 100644 --- a/src/core/scripting/python/python_script_context.h +++ b/src/core/scripting/python/python_script_context.h @@ -49,9 +49,13 @@ class PythonScriptContext : public ScriptContext { } void PhysicsProcess(Entity entity, double deltaTime) override { - if (PyObject_HasAttr(pythonCache->GetClassInstance(entity), physicsProcessFunctionName)) { - CPyObject processCallValue = PyObject_CallMethod(pythonCache->GetClassInstance(entity), "_physics_process", "(f)", deltaTime); + PyGILState_STATE pyGilStateState = PyGILState_Ensure(); + { + if (PyObject_HasAttr(pythonCache->GetClassInstance(entity), physicsProcessFunctionName)) { + CPyObject processCallValue = PyObject_CallMethod(pythonCache->GetClassInstance(entity), "_physics_process", "(f)", deltaTime); + } } + PyGILState_Release(pyGilStateState); PyErr_Print(); }