Skip to content

Commit 23b5efc

Browse files
authored
Acquire gil for the full scope of the lifetime returned matrix (#609)
1 parent a74b758 commit 23b5efc

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ForceField.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ namespace sofapython3
121121
template<class TDOFType>
122122
py::object ForceField_Trampoline<TDOFType>::_addKToMatrix(const MechanicalParams* mparams, int nIndices, int nDofs)
123123
{
124-
PythonEnvironment::gil acquire;
125124

126125
py::dict mp = py::dict("time"_a=getContext()->getTime(),
127126
"mFactor"_a=mparams->mFactor(),
@@ -136,6 +135,8 @@ namespace sofapython3
136135
template<class TDOFType>
137136
void ForceField_Trampoline<TDOFType>::addKToMatrix(const MechanicalParams* mparams, const MultiMatrixAccessor* dfId)
138137
{
138+
PythonEnvironment::gil acquire;
139+
139140
MultiMatrixAccessor::MatrixRef mref = dfId->getMatrix(this->mstate);
140141
sofa::linearalgebra::BaseMatrix* mat = mref.matrix;
141142

0 commit comments

Comments
 (0)