missing Lock on parseur added.
[scilab.git] / scilab / modules / functions / sci_gateway / cpp / sci_execstr.cpp
index 585957b..0c06a81 100644 (file)
@@ -22,6 +22,7 @@
 #include "scilabWrite.hxx"
 #include "scilabexception.hxx"
 #include "configvariable.hxx"
+#include "threadmanagement.hxx"
 
 #include <iostream>
 #include <fstream>
@@ -139,6 +140,7 @@ Function::ReturnValue sci_execstr(types::typed_list &in, int _iRetCount, types::
         pstCommand[iPos] = 0;
     }
 
+    ThreadManagement::LockParser();
     parser.parse(pstCommand);
     FREE(pstCommand);
     if (parser.getExitStatus() !=  Parser::Succeded)
@@ -150,6 +152,7 @@ Function::ReturnValue sci_execstr(types::typed_list &in, int _iRetCount, types::
             ConfigVariable::setLastErrorCall();
             ConfigVariable::setLastErrorMessage(parser.getErrorMessage());
             ConfigVariable::setLastErrorNumber(999);
+            ThreadManagement::UnlockParser();
             return Function::OK;
         }
         else
@@ -157,6 +160,7 @@ Function::ReturnValue sci_execstr(types::typed_list &in, int _iRetCount, types::
             char* pst = wide_string_to_UTF8(parser.getErrorMessage());
             Scierror(999, "%s", pst);
             FREE(pst);
+            ThreadManagement::UnlockParser();
             return Function::Error;
         }
     }
@@ -180,6 +184,8 @@ Function::ReturnValue sci_execstr(types::typed_list &in, int _iRetCount, types::
         pExp = parser.getTree();
     }
 
+    ThreadManagement::UnlockParser();
+
     if (pExp == NULL)
     {
         return Function::Error;