[Solved]Strange crash on button click

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

AlanDa
Just popping in
Just popping in
Posts: 12
Joined: Wed Aug 26, 2009 17:13

[Solved]Strange crash on button click

Postby AlanDa » Mon Dec 20, 2010 04:59

I got a strange crash when using a button to destroy its parent window.

I striped the code down but it's still crashing.

That's the code:

Code: Select all

      CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
      CEGUI::DefaultWindow* fWnd = (CEGUI::DefaultWindow*)winMgr.createWindow( "TaharezLook/FrameWindow", "WndTest" );
      fWnd->setWidth(CEGUI::UDim(0.0f, 800.0f));
      fWnd->setHeight(CEGUI::UDim(0.0f, 400.0f));


      CEGUI::DefaultWindow *btnAbort = (CEGUI::DefaultWindow*)winMgr.createWindow( "TaharezLook/Button", "WndTest/btnAbort");
      btnAbort->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0f, 350.0f ), CEGUI::UDim( 0.0f, 350.0f ) ) );
      btnAbort->setSize( CEGUI::UVector2( CEGUI::UDim( 0.0f, 150.0f ), CEGUI::UDim( 0.0f, 25.0f ) ) );
      btnAbort->subscribeEvent("Clicked", CEGUI::Event::Subscriber(&GUI::onTestAbortClicked));
      fWnd->addChildWindow(btnAbort);

      fWnd->subscribeEvent("CloseClicked", CEGUI::Event::Subscriber(&GUI::onTestAbortClicked));
      
      myRoot->addChildWindow(fWnd);


My onTestAbortClicked func is simply

Code: Select all

myRoot->getChild("WndTest")->destroy();


The strange thing is that the CloseClicked event destroys the window while the button clicked event crashes the app.
The crash is @ CEGUIBase.dll @ offset 0x000040e0 which is inside the CEGUI::Listbox::testClassName_impl function. No clue what's going on.
I'm using CEGUI 0.6.2.

Any help would be much appreciated.

Edit: Well.. the crash is gone. It was prolly MSVC' fault. Not sure tho.

Return to “Help”

Who is online

Users browsing this forum: Baidu [Spider] and 27 guests