put an extraction in context corrected. 16/14916/4
Cedric Delamarre [Mon, 21 Jul 2014 10:36:04 +0000 (12:36 +0200)]
ml=mlist(["type" "field"], 15)
ml = ml.field

l = list(1, 2, 3)
l=l(2)

Change-Id: I69f48d4f2d7403288b2d6803ffbee37d09139ac9

scilab/modules/ast/includes/symbol/variables.hxx
scilab/modules/ast/src/cpp/ast/runvisitor.cpp

index e85fc36..c925bce 100644 (file)
@@ -73,10 +73,12 @@ struct Variable
             types::InternalType* pIT = top()->m_pIT;
             if (pIT != _pIT)
             {
-                pIT->DecreaseRef();
-                pIT->killMe();
+                // _pIT may contained in pIT
+                // so increases ref of _pIT before kill pIT
                 top()->m_pIT = _pIT;
                 _pIT->IncreaseRef();
+                pIT->DecreaseRef();
+                pIT->killMe();
             }
         }
     }
index 83b909a..afa0572 100644 (file)
@@ -152,16 +152,6 @@ void RunVisitorT<T>::visitprivate(const FieldExp &e)
 
     if (ok)
     {
-        /*
-        // segfault on insert.tst... check why ??
-        // probably extractor needs to increaseref of extracted field...
-
-        if (pValue != pReturn && pValue->isDeletable())
-        {
-        delete pValue;
-        }
-        */
-
         result_set(pReturn);
     }
     else if (pValue->isFieldExtractionOverloadable())