How can I remove an event if it is executing? [solved]
Posted: Sat Mar 21, 2009 19:11
Hi.
My code is:
When I click the button, I get a segmentation fault.
Thanks.
Edit: I solved it. I override the old event by the new event
Edit 2:
Finally, I needed to use a "deadlist". When a Button was clicked, its event was pushed back in the list. The list was updated (cleared) every frame.
My code is:
Code: Select all
...
button->subscribeEvent(PushButton::EventMouseClick, Event::Subscriber (&MyClass::onEventClick, this));
...
bool MyClass::onEventClick (const CEGUI::EventArgs& pEventArgs)
{
button->removeAllEvents();
// I want to subscribe another event to this button in this place
}
When I click the button, I get a segmentation fault.
Thanks.
Edit: I solved it. I override the old event by the new event
Code: Select all
...
button->subscribeEvent(PushButton::EventMouseClick, Event::Subscriber (&MyClass::onEventClick, this));
...
bool MyClass::onEventClick (const CEGUI::EventArgs& pEventArgs)
{
button->subscribeEvent(PushButton::EventMouseClick, Event::Subscriber (&MyClass::newHandler, this));
}
Edit 2:
Finally, I needed to use a "deadlist". When a Button was clicked, its event was pushed back in the list. The list was updated (cleared) every frame.