fix sparse module tests 60/17660/3
Antoine ELIAS [Mon, 11 Jan 2016 15:59:01 +0000 (16:59 +0100)]
Change-Id: Ie96a4152c0cc771aacf1891931853dd3b3e860ad

scilab/modules/ast/includes/ast/runvisitor.hxx
scilab/modules/ast/src/cpp/ast/run_AssignExp.hpp
scilab/modules/ast/src/cpp/ast/run_CallExp.hpp
scilab/modules/ast/src/cpp/types/sparse.cpp

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();
+                }
+            }
         }
     }
 
index 7bace5f..c692919 100644 (file)
@@ -414,7 +414,7 @@ void RunVisitorT<T>::visitprivate(const AssignExp  &e)
             for (i = iLhsCount - 1; i >= 0; i--)
             {
                 //create a new AssignExp and run it
-                pIT[i] = (exec.getResult(i));
+                pIT[i] = exec.getResult(i);
                 //protet rhs against removal [a,b] = (b,a);
                 pIT[i]->IncreaseRef();
             }
index af8f604..6eb86a1 100644 (file)
@@ -218,7 +218,7 @@ void RunVisitorT<T>::visitprivate(const CallExp &e)
         {
             pListArg = in[0]->getAs<types::List>();
             iLoopSize = pListArg->getSize();
-            cleanOpt(opt);
+            cleanOpt(opt, out);
         }
 
         setExpectedSize(iSaveExpectedSize);
@@ -302,7 +302,7 @@ void RunVisitorT<T>::visitprivate(const CallExp &e)
                 setExpectedSize(iSaveExpectedSize);
                 setResult(out);
                 cleanIn(in, out);
-                cleanOpt(opt);
+                cleanOpt(opt, out);
 
                 // In case a.b(), getResult contain pIT ("b").
                 // If out == pIT, do not delete it.
@@ -355,7 +355,7 @@ void RunVisitorT<T>::visitprivate(const CallExp &e)
 
         clearResult();
         cleanInOut(in, out);
-        cleanOpt(opt);
+        cleanOpt(opt, out);
         CoverageInstance::stopChrono((void*)&e);
 
         throw ia;
@@ -370,7 +370,7 @@ void RunVisitorT<T>::visitprivate(const CallExp &e)
 
         clearResult();
         cleanInOut(in, out);
-        cleanOpt(opt);
+        cleanOpt(opt, out);
         CoverageInstance::stopChrono((void*)&e);
 
         throw ie;
index 23bae97..9e7a232 100644 (file)
@@ -2366,7 +2366,7 @@ SparseBool* Sparse::newLessThan(Sparse &o)
         outputRowCol(rowcolL.data());
 
         double r = o.get(0, 0);
-        if (r >= 0)
+        if (r > 0)
         {
             ret->setTrue(true);
         }