segfault fixed at Scilab exit 76/17376/3
Cedric Delamarre [Thu, 22 Oct 2015 13:40:05 +0000 (15:40 +0200)]
Change-Id: Ib68ec6b4a1c6b203956489c7a9d8d51915757677

scilab/modules/core/src/cpp/InitScilab.cpp

index 3325d75..dd9052c 100644 (file)
@@ -385,6 +385,10 @@ void StopScilabEngine(ScilabEngineInfo* _pSEI)
     //close console scope
     //symbol::Context::getInstance()->scope_end();
 
+    // close macros scope before close dynamic library.
+    // all pointers allocated by a dynamic library have to be free before dlclose.
+    symbol::Context::getInstance()->scope_end();
+
     //execute scilab.quit
     if (_pSEI->pstFile)
     {
@@ -403,9 +407,6 @@ void StopScilabEngine(ScilabEngineInfo* _pSEI)
         EndModules();
     }
 
-    //close macros scope
-    symbol::Context::getInstance()->scope_end();
-
     //close gateways scope
     symbol::Context::getInstance()->scope_end();
 
@@ -906,54 +907,54 @@ static void stateShow(Parser::ControlStatus status)
 {
     switch (status)
     {
-        //case Parser::WithinFor:
-        //    SetTemporaryPrompt("-for       ->");
-        //    break;
-        //case Parser::WithinWhile:
-        //    SetTemporaryPrompt("-while     ->");
-        //    break;
-        //case Parser::WithinIf:
-        //    SetTemporaryPrompt("-if        ->");
-        //    break;
-        //case Parser::WithinElse:
-        //    SetTemporaryPrompt("-else      ->");
-        //    break;
-        //case Parser::WithinElseIf:
-        //    SetTemporaryPrompt("-elseif    ->");
-        //    break;
-        //case Parser::WithinTry:
-        //    SetTemporaryPrompt("-try       ->");
-        //    break;
-        //case Parser::WithinCatch:
-        //    SetTemporaryPrompt("-catch     ->");
-        //    break;
-        //case Parser::WithinFunction:
-        //    SetTemporaryPrompt("-function  ->");
-        //    break;
-        //case Parser::WithinSelect:
-        //    SetTemporaryPrompt("-select    ->");
-        //    break;
-        //case Parser::WithinCase:
-        //    SetTemporaryPrompt("-case      ->");
-        //    break;
-        //case Parser::WithinSwitch:
-        //    SetTemporaryPrompt("-switch    ->");
-        //    break;
-        //case Parser::WithinOtherwise:
-        //    SetTemporaryPrompt("-otherwise ->");
-        //    break;
-        //case Parser::WithinMatrix:
-        //    SetTemporaryPrompt("- [        ->");
-        //    break;
-        //case Parser::WithinCell:
-        //    SetTemporaryPrompt("- {        ->");
-        //    break;
-        //case Parser::WithinBlockComment:
-        //    SetTemporaryPrompt("- /*       ->");
-        //    break;
-        //case Parser::WithinDots:
-        //    SetTemporaryPrompt("- ...      ->");
-        //    break;
+            //case Parser::WithinFor:
+            //    SetTemporaryPrompt("-for       ->");
+            //    break;
+            //case Parser::WithinWhile:
+            //    SetTemporaryPrompt("-while     ->");
+            //    break;
+            //case Parser::WithinIf:
+            //    SetTemporaryPrompt("-if        ->");
+            //    break;
+            //case Parser::WithinElse:
+            //    SetTemporaryPrompt("-else      ->");
+            //    break;
+            //case Parser::WithinElseIf:
+            //    SetTemporaryPrompt("-elseif    ->");
+            //    break;
+            //case Parser::WithinTry:
+            //    SetTemporaryPrompt("-try       ->");
+            //    break;
+            //case Parser::WithinCatch:
+            //    SetTemporaryPrompt("-catch     ->");
+            //    break;
+            //case Parser::WithinFunction:
+            //    SetTemporaryPrompt("-function  ->");
+            //    break;
+            //case Parser::WithinSelect:
+            //    SetTemporaryPrompt("-select    ->");
+            //    break;
+            //case Parser::WithinCase:
+            //    SetTemporaryPrompt("-case      ->");
+            //    break;
+            //case Parser::WithinSwitch:
+            //    SetTemporaryPrompt("-switch    ->");
+            //    break;
+            //case Parser::WithinOtherwise:
+            //    SetTemporaryPrompt("-otherwise ->");
+            //    break;
+            //case Parser::WithinMatrix:
+            //    SetTemporaryPrompt("- [        ->");
+            //    break;
+            //case Parser::WithinCell:
+            //    SetTemporaryPrompt("- {        ->");
+            //    break;
+            //case Parser::WithinBlockComment:
+            //    SetTemporaryPrompt("- /*       ->");
+            //    break;
+            //case Parser::WithinDots:
+            //    SetTemporaryPrompt("- ...      ->");
+            //    break;
         default :
             SetTemporaryPrompt("  > ");
             break;