Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2008, 1:48:57 PM (16 years ago)
Author:
landauf
Message:
  • simplified some event code
  • prevents infinite event loops
  • fixed some leaky memory behavior in XMLPort and EventIncludes
Location:
code/branches/objecthierarchy/src/orxonox/objects
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/objects/EventListener.cc

    r2074 r2082  
    4141    {
    4242        RegisterObject(EventListener);
     43
     44        this->bActive_ = false;
    4345    }
    4446
     
    5658    void EventListener::processEvent(Event& event)
    5759    {
     60        if (this->bActive_)
     61        {
     62            COUT(2) << "Warning: Detected Event loop in EventListener \"" << this->getName() << "\"" << std::endl;
     63            return;
     64        }
     65
     66        this->bActive_ = true;
     67
    5868        this->fireEvent(event.activate_, event.originator_);
     69
     70        this->bActive_ = false;
    5971    }
    6072
  • code/branches/objecthierarchy/src/orxonox/objects/EventListener.h

    r2074 r2082  
    5555
    5656            std::string eventName_;
     57            bool bActive_;
    5758    };
    5859}
  • code/branches/objecthierarchy/src/orxonox/objects/EventTarget.cc

    r2074 r2082  
    6464    void EventTarget::addAsEvent(BaseObject* object)
    6565    {
    66         object->addEvent(this, "");
     66        if (object != (BaseObject*)this)
     67            object->addEvent(this, "");
    6768    }
    6869}
Note: See TracChangeset for help on using the changeset viewer.