Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9994 in orxonox.OLD for branches/coll_rect/src


Ignore:
Timestamp:
Dec 3, 2006, 6:24:08 PM (18 years ago)
Author:
patrick
Message:

found another two segfaults and removed them

Location:
branches/coll_rect/src/lib/collision_reaction
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/coll_rect/src/lib/collision_reaction/collision_tube.cc

    r9985 r9994  
    3434  ObjectListDefinition(CollisionTube);
    3535
    36   CollisionTube* CollisionTube::instance = NULL;
     36  CollisionTube* CollisionTube::singletonRef = NULL;
    3737
    3838
     
    6767  void CollisionTube::registerCollisionEvent(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB)
    6868  {
    69     Collision* collision = this->_collisionList.back();
     69    Collision* collision = NULL;
     70    if( !this->_collisionList.empty())
     71      collision = this->_collisionList.back();
    7072
    71     // check if there is already a collision defined between these objects
    72     if( !collision->match(*entityA, *entityB))
     73    // check if there is already a collision defined between these objects or this is the first collision at all
     74    if( collision != NULL || !collision->match(*entityA, *entityB))
    7375    {
    7476      collision = CREngine::getInstance()->popCollisionObject();
     
    9698  {
    9799    // get last collision
    98     Collision* collision = this->_collisionList.back();
     100    Collision* collision = NULL;
     101    if( !this->_collisionList.empty())
     102      collision = this->_collisionList.back();
    99103
    100104    // check if there is already a collision defined between these objects
  • branches/coll_rect/src/lib/collision_reaction/collision_tube.h

    r9993 r9994  
    5454    /* Constructor/Deconstructor/Singleton Interface */
    5555  public:
    56     inline static CollisionTube* getInstance() { if( CollisionTube::instance == NULL) CollisionTube::instance = new CollisionTube(); return CollisionTube::instance; }
     56    inline static CollisionTube* getInstance() { if( !singletonRef) singletonRef = new CollisionTube(); return singletonRef; }
     57
    5758    virtual ~CollisionTube();
    5859
     
    6162    CollisionTube(const CollisionTube& tube) {}
    6263
    63     static CollisionTube*          instance;                         //!< the singleton instance
     64    static CollisionTube*          singletonRef;                         //!< the singleton instance
    6465
    6566
Note: See TracChangeset for help on using the changeset viewer.