fix sparse module tests
[scilab.git] / scilab / modules / ast / includes / ast / runvisitor.hxx
index 150ec95..fa459df 100644 (file)
@@ -260,10 +260,18 @@ public:
         }
     }
 
-    void cleanOpt(const types::optional_list & opt)
+    void cleanOpt(const types::optional_list & opt, const types::typed_list & out)
     {
         if (!opt.empty())
         {
+            for (types::typed_list::const_iterator o = out.begin(); o != out.end(); ++o)
+            {
+                if (*o)
+                {
+                    (*o)->IncreaseRef();
+                }
+            }
+            
             for (types::optional_list::const_iterator o = opt.begin(); o != opt.end(); ++o)
             {
                 if (o->second)
@@ -273,6 +281,14 @@ public:
                     o->second->killMe();
                 }
             }
+
+            for (types::typed_list::const_iterator o = out.begin(); o != out.end(); ++o)
+            {
+                if (*o)
+                {
+                    (*o)->DecreaseRef();
+                }
+            }
         }
     }