I have a serious problem with the events in CEGUI ... it is no problem to register new handlers for events but i can't unsubscribe them ... I tried everything and searched the whole forum but I didn't find a solution ...
Here's a the piece of code I use .. don't worry, this code is only for testing ...
Code: Select all
// The eventName is always "MouseClick"
CEGUI::Event::ConnectionInterface* connection;
void thorGuiObject::SubscribeEvent( const char* eventName, const luabind::adl::object& luaFunc )
{
connection = _targetWindow->subscribeEvent( eventName, CEGUI::Event::Subscriber( &thorGuiObject::HandleEvent, this )).get();
LogManager::getSingleton().logMessage( "Subscribe" );
}
void thorGuiObject::UnsubscribeEvent( const char* eventName )
{
connection->disconnect();
//delete connection;
LogManager::getSingleton().logMessage( "Unsubscribe" );
}
bool thorGuiObject::HandleEvent( const CEGUI::EventArgs& e )
{
LogManager::getSingleton().logMessage( "Event handled" );
UnsubscribeEvent( "MouseClick" );
return true;
}
Everytime I want to unsubscribe I get an error message like this:
I don't know what to ... what am i doing wrong?? Please help me...
C YA - []Nuker