Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 16, 2010, 10:49:35 AM (15 years ago)
Author:
dafrick
Message:

Resolved segmentation fault, when destroying a PickupCompilation.

Location:
code/trunk/src/orxonox/interfaces
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc

    r6524 r6533  
    6464    PickupCarrier::~PickupCarrier()
    6565    {
    66         for(std::set<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
     66        while(this->pickups_.size() > 0)
    6767        {
     68            std::set<Pickupable*>::iterator it = this->pickups_.begin();
     69            this->pickups_.erase(it);
    6870            (*it)->destroy();
    6971        }
    70        
     72
    7173        this->pickups_.clear();
    7274    }
  • code/trunk/src/orxonox/interfaces/PickupCarrier.h

    r6524 r6533  
    4141#include "Pickupable.h"
    4242#include "core/Identifier.h"
     43#include "core/WeakPtr.h"
    4344
    4445#include "core/OrxonoxClass.h"
  • code/trunk/src/orxonox/interfaces/Pickupable.h

    r6524 r6533  
    114114                { return this->pickupIdentifier_; }
    115115               
    116             virtual void destroy(void)
    117                 { delete this; }
    118                
    119116            //TODO: Make them work as protected.
    120117            bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input.
Note: See TracChangeset for help on using the changeset viewer.