Code: Select all
void MainMenuScene::CreateScene(void)
{
CEGUI::WindowManager::getSingleton().loadWindowLayout((utf8*)"Media/Layouts/mainmenu.xml");
CEGUI::System::getSingleton().getGUISheet()->addChildWindow((utf8*)"mainmenu");
WindowManager::getSingleton().getWindow((utf8*)"Mainmenu/Quit")->
subscribeEvent(PushButton::Clicked, boost::bind(&MainMenuScene::OnQuitButton,this,_1));
}
void MainMenuScene::OnQuitButton(const EventArgs& args)
{
}
Everything works absolutly fine, up until I actually click on the Quit button. When I do this, I get a Runtime error messagebox saying it "Requested the Runtime to terminate it in an unusual way"
If I do the following then it does exactly the same, with the same crash message and everything:
Code: Select all
Event::Subscriber es = boost::bind(&MainMenuScene::OnQuitButton,this,_1);
EventArgs e;
es(e);
And yet if I do it the even more direct way then it doesn't crash and does exactly what you would expect:
Code: Select all
EventArgs e;
boost::bind(&MainMenuScene::OnQuitButton,this,_1){e};
Can anyone see what the stupid mistake is here? I can't see anything at all wrong with it, except for the obvious fact that it doesn't work...
--
Graham