Ignore:
Timestamp:
09/30/16 15:28:05 (8 years ago)
Author:
rlacroix
Message:

Fix a possible crash caused by an infinite recursion.

The way virtual groups were handled could cause id clashes which lead to have groups containing themselves.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/file.cpp

    r952 r957  
    2626      , allDomainEmpty(false), isOpen(false) 
    2727   { 
    28      setVirtualFieldGroup(); 
    29      setVirtualVariableGroup(); 
     28     setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group")); 
     29     setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); 
    3030   } 
    3131 
     
    3535      , allDomainEmpty(false), isOpen(false) 
    3636    { 
    37       setVirtualFieldGroup(); 
    38       setVirtualVariableGroup(); 
     37      setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group")); 
     38      setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); 
    3939    } 
    4040 
     
    187187   { 
    188188      this->vVariableGroup = newVVariableGroup; 
    189    } 
    190  
    191    //---------------------------------------------------------------- 
    192    //! Create virtual field group, which is done normally on initializing file 
    193    void CFile::setVirtualFieldGroup(void) 
    194    { 
    195       this->setVirtualFieldGroup(CFieldGroup::create()); 
    196    } 
    197  
    198    //! Create virtual variable group, which is done normally on initializing file 
    199    void CFile::setVirtualVariableGroup(void) 
    200    { 
    201       this->setVirtualVariableGroup(CVariableGroup::create()); 
    202189   } 
    203190 
     
    944931   void CFile::sendAddAllVariables() 
    945932   { 
    946      if (!getAllVariables().empty()) 
     933     std::vector<CVariable*> allVar = getAllVariables(); 
     934     std::vector<CVariable*>::const_iterator it = allVar.begin(); 
     935     std::vector<CVariable*>::const_iterator itE = allVar.end(); 
     936 
     937     for (; it != itE; ++it) 
    947938     { 
    948        // Firstly, it's necessary to add virtual variable group 
    949        sendAddVariableGroup(getVirtualVariableGroup()->getId()); 
    950  
    951        // Okie, now we can add to this variable group 
    952        std::vector<CVariable*> allVar = getAllVariables(); 
    953        std::vector<CVariable*>::const_iterator it = allVar.begin(); 
    954        std::vector<CVariable*>::const_iterator itE = allVar.end(); 
    955  
    956        for (; it != itE; ++it) 
    957        { 
    958          this->sendAddVariable((*it)->getId()); 
    959          (*it)->sendAllAttributesToServer(); 
    960          (*it)->sendValue(); 
    961        } 
     939       this->sendAddVariable((*it)->getId()); 
     940       (*it)->sendAllAttributesToServer(); 
     941       (*it)->sendValue(); 
    962942     } 
    963943   } 
Note: See TracChangeset for help on using the changeset viewer.