Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 18, 2005, 5:33:11 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Elemet2D-drawing better
prevent segfault in setParent with NULL as new Parent in Element2D and PNode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r5396 r5397  
    3535{
    3636  this->init();
     37  Render2D::getInstance()->registerElement2D(this);
    3738  this->setParent2D(NullElement2D::getInstance());
    3839}
     
    4849{
    4950  this->init();
     51  Render2D::getInstance()->registerElement2D(this);
    5052
    5153  // check Parenting, and if ok parent the stuff
     
    124126  this->toDirection = NULL;
    125127  this->setSize2D(1,1);
    126 
    127   Render2D::getInstance()->registerElement2D(this);
    128128}
    129129
     
    471471    child->parentMode = parentingMode;
    472472  child->parent = this;
    473   this->children->add(child);
     473  if (likely(this != NULL))
     474    this->children->add(child);
    474475  child->parentCoorChanged();
    475476}
     
    667668
    668669
    669     if (this->alignment == E2D_ALIGN_SCREEN_CENTER && this->bRelCoorChanged)
     670    if (unlikely(this->alignment & E2D_ALIGN_SCREEN_CENTER && this->bRelCoorChanged))
    670671    {
    671672      this->prevRelCoordinate = this->relCoordinate;
     
    674675      this->absCoordinate.z = 0.0;
    675676    }
    676     else if (this->bindNode)
     677    else if (unlikely(this->bindNode != NULL))
    677678    {
    678679      GLdouble projectPos[3];
Note: See TracChangeset for help on using the changeset viewer.