Crash While Destroying GUI (also States)

oppen

21-06-2010 03:49:37

If this is a common/simple issue I apologize. I have looked all over and haven't really found anything that truly helps.

My application is using a state manager (specifically the Advanced Ogre Framework) and I am having issues using it with MyGUI. Everything works fine in my first state (mainMenu) but switching to another state (in this example emptySceneState) the application always crashes.

Here is my set up for mainMenuState:

mainMenuState.h


class MainMenuState : public AppState
{
public:

...

private:
bool m_bQuit;

MyGUI::Gui* mGUI;
MyGUI::OgrePlatform* mPlatform;
MyGUI::VectorWidgetPtr mainLayout;
};


Then in mainMenuState.cpp:


void MainMenuState::enter( )
{

...

createGUI( );

...
}

...

void MainMenuState::createGUI( )
{
mPlatform = new MyGUI::OgrePlatform( );
mPlatform->initialise( OgreFramework::getSingletonPtr()->m_pRenderWnd, m_pSceneMgr );
mPlatform->getRenderManagerPtr()->setSceneManager( m_pSceneMgr );

mGUI = new MyGUI::Gui( );
mGUI->initialise( "core.xml" );

mainLayout = MyGUI::LayoutManager::getInstance().load( "mainMenu.layout" );
}

...

void MainMenuState::destroyGUI( )
{
MyGUI::LayoutManager::getInstancePtr()->unloadLayout( mainLayout );

mGUI->shutdown();
delete mGUI;
mGUI = 0;

mPlatform->shutdown();
delete mPlatform;
mPlatform = 0;
}

...

void MainMenuState::buttonNewScenePressed( MyGUI::WidgetPtr _widget )
{
destroyGUI( );

changeAppState(findByName("EmptySceneState"));
}



Like I said, it all works correctly in mainMenuState, but whenever I go to switch to emptySceneState and essentially re-make the GUI it crashes.

There is no difference between emptySceneState.h and mainMenuState.h concerning MyGUI. Same with the CreateGUI function. Here is the MyGUI log if it would help:


----------------------------------------------------------------------------------------------------------------------------------
loging report for : 06/20/2010 22:43:09
----------------------------------------------------------------------------------------------------------------------------------

22:43:09 | Platform | Info | * Initialise: OgreRenderManager | .\src\MyGUI_OgreRenderManager.cpp | 26
22:43:09 | Platform | Info | OgreRenderManager successfully initialized | .\src\MyGUI_OgreRenderManager.cpp | 54
22:43:09 | Platform | Info | * Initialise: OgreDataManager | .\src\MyGUI_OgreDataManager.cpp | 45
22:43:09 | Platform | Info | OgreDataManager successfully initialized | .\src\MyGUI_OgreDataManager.cpp | 49
22:43:09 | Core | Info | * Initialise: Gui | .\src\MyGUI_Gui.cpp | 82
22:43:09 | Core | Info | * MyGUI version 3.0.1 | .\src\MyGUI_Gui.cpp | 86
22:43:09 | Core | Info | * Initialise: ResourceManager | .\src\MyGUI_ResourceManager.cpp | 43
22:43:09 | Core | Info | ResourceManager successfully initialized | .\src\MyGUI_ResourceManager.cpp | 51
22:43:09 | Core | Info | * Initialise: LayerManager | .\src\MyGUI_LayerManager.cpp | 44
22:43:09 | Core | Info | LayerManager successfully initialized | .\src\MyGUI_LayerManager.cpp | 52
22:43:09 | Core | Info | * Initialise: WidgetManager | .\src\MyGUI_WidgetManager.cpp | 66
22:43:09 | Core | Info | WidgetManager successfully initialized | .\src\MyGUI_WidgetManager.cpp | 105
22:43:09 | Core | Info | * Initialise: InputManager | .\src\MyGUI_InputManager.cpp | 41
22:43:09 | Core | Info | InputManager successfully initialized | .\src\MyGUI_InputManager.cpp | 58
22:43:09 | Core | Info | * Initialise: SubWidgetManager | .\src\MyGUI_SubWidgetManager.cpp | 44
22:43:09 | Core | Info | SubWidgetManager successfully initialized | .\src\MyGUI_SubWidgetManager.cpp | 64
22:43:09 | Core | Info | * Initialise: SkinManager | .\src\MyGUI_SkinManager.cpp | 46
22:43:09 | Core | Info | SkinManager successfully initialized | .\src\MyGUI_SkinManager.cpp | 54
22:43:09 | Core | Info | * Initialise: FontManager | .\src\MyGUI_FontManager.cpp | 43
22:43:09 | Core | Info | FontManager successfully initialized | .\src\MyGUI_FontManager.cpp | 52
22:43:09 | Core | Info | * Initialise: ControllerManager | .\src\MyGUI_ControllerManager.cpp | 41
22:43:09 | Core | Info | ControllerManager successfully initialized | .\src\MyGUI_ControllerManager.cpp | 51
22:43:09 | Core | Info | * Initialise: PointerManager | .\src\MyGUI_PointerManager.cpp | 51
22:43:09 | Core | Info | PointerManager successfully initialized | .\src\MyGUI_PointerManager.cpp | 69
22:43:09 | Core | Info | * Initialise: ClipboardManager | .\src\MyGUI_ClipboardManager.cpp | 82
22:43:09 | Core | Info | ClipboardManager successfully initialized | .\src\MyGUI_ClipboardManager.cpp | 96
22:43:09 | Core | Info | * Initialise: LayoutManager | .\src\MyGUI_LayoutManager.cpp | 42
22:43:09 | Core | Info | LayoutManager successfully initialized | .\src\MyGUI_LayoutManager.cpp | 48
22:43:09 | Core | Info | * Initialise: DynLibManager | .\src\MyGUI_DynLibManager.cpp | 34
22:43:09 | Core | Info | DynLibManager successfully initialized | .\src\MyGUI_DynLibManager.cpp | 36
22:43:09 | Core | Info | * Initialise: PluginManager | .\src\MyGUI_PluginManager.cpp | 36
22:43:09 | Core | Info | PluginManager successfully initialized | .\src\MyGUI_PluginManager.cpp | 40
22:43:09 | Core | Info | * Initialise: LanguageManager | .\src\MyGUI_LanguageManager.cpp | 40
22:43:09 | Core | Info | LanguageManager successfully initialized | .\src\MyGUI_LanguageManager.cpp | 44
22:43:09 | Core | Info | * Initialise: FactoryManager | .\src\MyGUI_FactoryManager.cpp | 34
22:43:09 | Core | Info | FactoryManager successfully initialized | .\src\MyGUI_FactoryManager.cpp | 37
22:43:09 | Core | Info | Load ini file 'core_theme.xml' | .\src\MyGUI_ResourceManager.cpp | 152
22:43:09 | Core | Info | Load ini file 'core_language.xml' | .\src\MyGUI_ResourceManager.cpp | 152
22:43:09 | Core | Info | Load ini file 'core_font.xml' | .\src\MyGUI_ResourceManager.cpp | 152
22:43:09 | Core | Info | ResourceTrueTypeFont 'font_DejaVuSans.17' using texture size 512 x 256 | .\src\MyGUI_ResourceTrueTypeFont.cpp | 203
22:43:09 | Core | Info | ResourceTrueTypeFont 'font_DejaVuSans.17' using real height 17 pixels | .\src\MyGUI_ResourceTrueTypeFont.cpp | 204
22:43:09 | Core | Info | ResourceTrueTypeFont 'font_DejaVuSans.14' using texture size 256 x 256 | .\src\MyGUI_ResourceTrueTypeFont.cpp | 203
22:43:09 | Core | Info | ResourceTrueTypeFont 'font_DejaVuSans.14' using real height 14 pixels | .\src\MyGUI_ResourceTrueTypeFont.cpp | 204
22:43:09 | Core | Info | Load ini file 'core_resource.xml' | .\src\MyGUI_ResourceManager.cpp | 152
22:43:09 | Core | Info | Load ini file 'core_skin.xml' | .\src\MyGUI_ResourceManager.cpp | 152
22:43:10 | Core | Info | Load ini file 'core_pointer.xml' | .\src\MyGUI_ResourceManager.cpp | 152
22:43:10 | Core | Info | Load ini file 'core_layer.xml' | .\src\MyGUI_ResourceManager.cpp | 152
22:43:10 | Core | Info | Load ini file 'core_settings.xml' | .\src\MyGUI_ResourceManager.cpp | 152
22:43:10 | Core | Info | Gui successfully initialized | .\src\MyGUI_Gui.cpp | 129
22:43:10 | Core | Info | load layout 'inStateMenu.layout' | .\src\MyGUI_LayoutManager.cpp | 73


Also, both states use m_pSceneMgr as the SceneManager as you can see. This is defined in AppStateManager.h.

Anyone have any advice regarding this specific issue? Or properly using MyGUI with a State system? I did read viewtopic.php?f=17&t=12652 but it didn't help me much since I am so new/still uncomfortable with MyGUI.

I am really enjoying MyGUI and hope that this issue can be solved soon so I can continue using it.

dave2041

29-06-2010 15:22:37

Well you haven't actually posted what your error is!?

Can you actually access the m_pSceneMgr that you have defined in the appStateManager? afaik m_pSceneMgr is defined in appState which is a baseclass for any states that you create from it.

EDIT: That thread you linked to is very useful but if you still can't solve your problem post your errors here (the ogre log might be more useful than the MyGUI one)