Salome HOME
22431: EDF SMESH Regression: segmentation violation with BLSURF
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_BLSURF.cxx
index e89d86457970a01c55d8f8e848227a68eea0ce69..4cfa4f0d1f1beeffc215698b614d33e18e1c7a0b 100644 (file)
@@ -2407,6 +2407,7 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
             if (theSizeMapStr.find(bad_end) == (theSizeMapStr.size()-bad_end.size()-1))
               continue;
             // Expr To Python function, verification is performed at validation in GUI
+            gstate = PyGILState_Ensure();
             PyObject * obj = NULL;
             obj= PyRun_String(theSizeMapStr.c_str(), Py_file_input, main_dict, NULL);
             Py_DECREF(obj);
@@ -2414,6 +2415,7 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
             func = PyObject_GetAttrString(main_mod, "f");
             VertexId2PythonSmp[*ip]=func;
             VertexId2SizeMap.erase(vertexKey);   // do not erase if using a vector
+            PyGILState_Release(gstate);
           }
         }
       }