Crash: Window gets destroyed using ALT+F4
Posted: Fri Nov 16, 2012 17:53
I just wanted to mess around a bit with CEGUI and OGRE as a beginner and have some issues when terminating my application.
Everything works as intended as long as the render window doesn't get destroyed. This happens if I close the window using ALT+F4. If I manually stop the game loop/tell ogre to stop rendering the application closed without any problem since the systems get destroyed in the right order (fist gui and last the renderer wich destroys the window).
I already tried differend approaches:
* Using an auto created window by ogre so I can use the bootstrapSystem and shutting it down using the CEGUI::OgreRenderer::destroySystem method
* Using a render window created with Ogre::Root::createRenderWindow then calling bootstrapSystem with the created render target as an argument. On destruction using CeGUI::OgreRenderer::destroy and CeGUI::System::destroy (of course I'm using the singletons)
* Using the manually created render window and initialising CEGUI creating the renderer and the system manually and destroy them manually using their destroy methods
Either way the same thing happens when the render window gets destroyed. I get an unhandled exception in the Ogre RenderSystem_Direct3D9_d.dll. If I step throug the source this happens when the Singleton of CEGUI::System gets deleted (line 1906 CEGUISystem.cpp).
Here is the CEGUI log and the callstack:
cegui log
http://nopaste.info/0393fce4af.html
callstack
http://nopaste.info/54e9fefc64.html
As for my CEGUI code I don't do much at this point:
Some other specs of which I think they might be important:
* Windows 7 64-bit SP1
* Geforce GTX 680 with Driver Version 301.10
* Microsoft Visual C++ 2010 Express
* Ogre 1-8-1 & dependencies compiled from source without boost lib
* CEGUI Version 0.7.7 (Build: Nov 15 2012 Debug Microsoft Windows MSVC++ 10.0 32 bit)
* Happens in DEBUG and RELEASE modes
/Edit: As a (temporary?) solution I made my own WndProc which is about the same as Ogres but calls my own engines quit() method instead of destroying the render window directly on WM QUIT.
Everything works as intended as long as the render window doesn't get destroyed. This happens if I close the window using ALT+F4. If I manually stop the game loop/tell ogre to stop rendering the application closed without any problem since the systems get destroyed in the right order (fist gui and last the renderer wich destroys the window).
I already tried differend approaches:
* Using an auto created window by ogre so I can use the bootstrapSystem and shutting it down using the CEGUI::OgreRenderer::destroySystem method
* Using a render window created with Ogre::Root::createRenderWindow then calling bootstrapSystem with the created render target as an argument. On destruction using CeGUI::OgreRenderer::destroy and CeGUI::System::destroy (of course I'm using the singletons)
* Using the manually created render window and initialising CEGUI creating the renderer and the system manually and destroy them manually using their destroy methods
Either way the same thing happens when the render window gets destroyed. I get an unhandled exception in the Ogre RenderSystem_Direct3D9_d.dll. If I step throug the source this happens when the Singleton of CEGUI::System gets deleted (line 1906 CEGUISystem.cpp).
Here is the CEGUI log and the callstack:
cegui log
http://nopaste.info/0393fce4af.html
callstack
http://nopaste.info/54e9fefc64.html
As for my CEGUI code I don't do much at this point:
Code: Select all
void GUI::init()
{
mpRenderer = &CEGUI::OgreRenderer::bootstrapSystem();
setupResources();
//
// [ Other code which makes my GUI class listen to input ]
//
}
void GUI::setupResources()
{
// Define resource groups to use
CEGUI::Imageset::setDefaultResourceGroup ( "imagesets" );
CEGUI::Font::setDefaultResourceGroup ( "fonts" );
CEGUI::Scheme::setDefaultResourceGroup ( "schemes" );
CEGUI::WidgetLookManager::setDefaultResourceGroup ( "looknfeel" );
CEGUI::WindowManager::setDefaultResourceGroup ( "layouts" );
CEGUI::ScriptModule::setDefaultResourceGroup ( "lua_scripts" );
CEGUI::AnimationManager::setDefaultResourceGroup ( "animations" );
// Load scheme
CEGUI::SchemeManager::getSingleton().create ( "WindowsLook.scheme" );
CEGUI::FontManager::getSingleton().create ( "DejaVuSans-10.font" );
CEGUI::System::getSingleton().setDefaultMouseCursor ( "WindowsLook", "MouseArrow" );
CEGUI::System::getSingleton().setDefaultTooltip ( "WindowsLook/Tooltip" );
// Create a root window
CEGUI::Window* root = CEGUI::WindowManager::getSingleton().createWindow ( "DefaultWindow", "_Root" )
CEGUI::System::getSingleton().setGUISheet ( root );
// Load a test layout.
CEGUI::Window* child = CEGUI::WindowManager::getSingleton().loadWindowLayout ( "WindowsLookConsole.layout" ); // Just the VanillaConsole.layout form the samples changed to WindowsLook
root->addChildWindow ( child );
}
void GUI::shutdown()
{
//
// [ Other code which makes my GUI stop listening to input ]
//
mpRenderer->destroySystem(); // Stepping here reveals the crash @ System::destroy()
// Exception only happens when the render window was destroyed (ALT+F4).
}
Some other specs of which I think they might be important:
* Windows 7 64-bit SP1
* Geforce GTX 680 with Driver Version 301.10
* Microsoft Visual C++ 2010 Express
* Ogre 1-8-1 & dependencies compiled from source without boost lib
* CEGUI Version 0.7.7 (Build: Nov 15 2012 Debug Microsoft Windows MSVC++ 10.0 32 bit)
* Happens in DEBUG and RELEASE modes
/Edit: As a (temporary?) solution I made my own WndProc which is about the same as Ogres but calls my own engines quit() method instead of destroying the render window directly on WM QUIT.