convert AnalysisVisitor into a Singleton
[scilab.git] / scilab / modules / core / src / cpp / tasks.cpp
index 5d86f33..a673b2b 100644 (file)
@@ -186,9 +186,10 @@ void execAstTask(ast::Exp* tree, bool serialize, bool timed, bool ASTtimed, bool
         //call analyzer visitor before exec visitor
         if (ConfigVariable::getAnalyzerOptions() == 1)
         {
-            FBlockListener fb;
-            analysis::AnalysisVisitor analysis;
-            analysis.registerFBlockEmittedListener(&fb);
+            FBlockListener listener;
+            analysis::AnalysisVisitor& analysis = analysis::AnalysisVisitor::getInstance();
+            analysis.reset();
+            analysis.registerFBlockEmittedListener(&listener);
             newTree->accept(analysis);
         }
 
@@ -274,6 +275,9 @@ int execScilabQuitTask(bool _bSerialize)
     std::wstring stSCI = ConfigVariable::getSCIPath();
     stSCI += SCILAB_QUIT;
 
+    //delete analysisVisitor
+    analysis::AnalysisVisitor::deleteInstance();
+
     ThreadManagement::LockParser();
     try
     {