Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7126 in orxonox.OLD for trunk/src/lib/coord


Ignore:
Timestamp:
Feb 13, 2006, 1:14:53 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: the delete Mechanism of PNode seems to work again.
This is done by always deleting the first node, and not walking through a list, that is eleminated during deletion time

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/coord/p_node.cc

    r7125 r7126  
    8080PNode::~PNode ()
    8181{
    82   printf("delete PNode: %s::%s\n", this->getClassName(), this->getName());
     82  PRINTF(4)("delete %s::%s\n", this->getClassName(), this->getName());
    8383  // remove the Node, delete it's children (if required).
    8484  std::list<PNode*>::iterator tmp = this->children.begin();
    8585  std::list<PNode*>::iterator deleteNode;
     86  unsigned int size;
    8687  while(!this->children.empty())
    87     while (tmp != this->children.end())
     88  {
     89    tmp = this->children.begin();
     90    //while (tmp != this->children.end())
    8891    {
    8992      deleteNode = tmp;
    9093      tmp++;
    91       //      printf("TEST::%s(%s) %s\n", (*deleteNode)->getName(), (*deleteNode)->getClassName(), this->getName());
     94      size = this->children.size();
    9295      if ((this->parentMode & PNODE_PROHIBIT_CHILD_DELETE) ||
    9396          ((*deleteNode)->parentMode & PNODE_PROHIBIT_DELETE_WITH_PARENT))
     
    9598        if (this == PNode::nullParent && (*deleteNode)->parentMode & PNODE_REPARENT_TO_NULL)
    9699        {
    97           printf("%s::%s deletes PNode: %s::%s\n",
     100          PRINTF(4)("%s::%s deletes %s::%s\n",
    98101                 this->getClassName(), this->getName(),
    99102                 (*deleteNode)->getClassName(), (*deleteNode)->getName());
     
    102105        else
    103106        {
    104           printf("%s::%s reparents PNode: %s::%s\n",
     107          PRINTF(4)("%s::%s reparents %s::%s\n",
    105108                 this->getClassName(), this->getName(),
    106109                 (*deleteNode)->getClassName(), (*deleteNode)->getName());
    107 
    108110          (*deleteNode)->reparent();
    109111        }
     
    111113      else
    112114      {
    113         printf("%s::%s deletes PNode: %s::%s\n",
     115        PRINTF(4)("%s::%s deletes PNode: %s::%s\n",
    114116               this->getClassName(), this->getName(),
    115117               (*deleteNode)->getClassName(), (*deleteNode)->getName());
    116118        delete (*deleteNode);
    117119      }
     120      //if (size <= this->children.size()) break;
    118121    }
     122  }
    119123
    120124  if (this->parent != NULL)
Note: See TracChangeset for help on using the changeset viewer.