Crash when calling destroyWindow

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

moron_venom
Just popping in
Just popping in
Posts: 8
Joined: Sun Apr 03, 2016 12:56

Crash when calling destroyWindow

Postby moron_venom » Sun Apr 03, 2016 13:25

CEGUI: 0.8.5 Visual Studio: 2013
Here's the Init function, I make a simple test by create a test window pTestWindow .
And the program crashed when I try to destroy the window, for it can't get titlebar I guess.
How can I fix that?

03/04/2016 21:16:47 (Error) CEGUI::UnknownObjectException in function 'class CEGUI::NamedElement *__thiscall CEGUI::NamedElement::getChildElement(const class CEGUI::String &) const' (E:\Workspace\Engine\Source\Engine\3rdParty\cegui-0.8.5\cegui\src\NamedElement.cpp:150) : The Element object referenced by '__auto_titlebar__' is not attached to Element at 'Dialog'.


03/04/2016 21:16:47 (Error) ========== Start of Backtrace ==========
03/04/2016 21:16:47 (Error) #0 CEGUI::Exception::Exception +0x326 (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #1 CEGUI::UnknownObjectException::UnknownObjectException +0x79 (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #2 CEGUI::NamedElement::getChildElement +0x1b9 (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #3 CEGUI::Window::getChild +0x1a (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #4 CEGUI::FrameWindow::getTitlebar +0x1b (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #5 CEGUI::FrameWindow::onDeactivated +0x22 (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #6 CEGUI::Window::deactivate +0x73 (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #7 CEGUI::Window::removeChild_impl +0x14f (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #8 CEGUI::Element::removeChild +0x118 (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #9 CEGUI::Window::destroy +0x19d (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #10 CEGUI::WindowManager::destroyWindow +0x37c (E:\Workspace\Engine\Game\CEGUIBase-0_d.dll)
03/04/2016 21:16:47 (Error) #11 GUIManager::Init +0xb58 (E:\Workspace\Engine\Source\Engine\MSVC\..\..\Bin\Win32Debug\EngineWin32Debug.exe)
03/04/2016 21:16:47 (Error) #12 HumanView::HumanView +0x16f (E:\Workspace\Engine\Source\Engine\MSVC\..\..\Bin\Win32Debug\EngineWin32Debug.exe)
03/04/2016 21:16:47 (Error) #13 EngineApp::VCreateGameAndView +0x107 (E:\Workspace\Engine\Source\Engine\MSVC\..\..\Bin\Win32Debug\EngineWin32Debug.exe)
03/04/2016 21:16:47 (Error) #14 EngineApp::InitInstance +0x80f (E:\Workspace\Engine\Source\Engine\MSVC\..\..\Bin\Win32Debug\EngineWin32Debug.exe)
03/04/2016 21:16:47 (Error) #15 SDL_main +0x8a (E:\Workspace\Engine\Source\Engine\MSVC\..\..\Bin\Win32Debug\EngineWin32Debug.exe)
03/04/2016 21:16:47 (Error) #16 main_utf8 +0x15 (E:\Workspace\Engine\Source\Engine\MSVC\..\..\Bin\Win32Debug\EngineWin32Debug.exe)
03/04/2016 21:16:47 (Error) #17 main +0x10 (E:\Workspace\Engine\Source\Engine\MSVC\..\..\Bin\Win32Debug\EngineWin32Debug.exe)
03/04/2016 21:16:47 (Error) #18 __tmainCRTStartup +0x11a (E:\Workspace\Engine\Source\Engine\MSVC\..\..\Bin\Win32Debug\EngineWin32Debug.exe)
03/04/2016 21:16:47 (Error) #19 mainCRTStartup +0xd (E:\Workspace\Engine\Source\Engine\MSVC\..\..\Bin\Win32Debug\EngineWin32Debug.exe)
03/04/2016 21:16:47 (Error) #20 BaseThreadInitThunk +0x12 (C:\Windows\syswow64\kernel32.dll)
03/04/2016 21:16:47 (Error) #21 RtlInitializeExceptionChain +0x63 (C:\Windows\SysWOW64\ntdll.dll)
03/04/2016 21:16:47 (Error) #22 RtlInitializeExceptionChain +0x36 (C:\Windows\SysWOW64\ntdll.dll)
03/04/2016 21:16:47 (Error) ========== End of Backtrace ==========


Code: Select all

void GUIManager::Init(  const std::string& resourceDirectory  )
   {
   if( !s_pRenderer || !s_pResProvider )
      {
      s_pRenderer = &CEGUI::OpenGL3Renderer::bootstrapSystem();
      s_pResProvider = static_cast< CEGUI::DefaultResourceProvider* >( CEGUI::System::getSingleton().getResourceProvider() );
      std::string resourceDir( resourceDirectory );
      s_pResProvider->setResourceGroupDirectory( "imagesets", resourceDir + "imagesets/" );
      s_pResProvider->setResourceGroupDirectory( "schemes", resourceDir + "schemes/" );
      s_pResProvider->setResourceGroupDirectory( "fonts", resourceDir + "fonts/" );
      s_pResProvider->setResourceGroupDirectory( "layouts", resourceDir + "layouts/" );
      s_pResProvider->setResourceGroupDirectory( "looknfeel", resourceDir + "looknfeel/" );
      s_pResProvider->setResourceGroupDirectory( "lua_scripts", resourceDir + "lua_scripts/" );

      CEGUI::ImageManager::setImagesetDefaultResourceGroup( "imagesets" );
      CEGUI::Scheme::setDefaultResourceGroup( "schemes" );
      CEGUI::Font::setDefaultResourceGroup( "fonts" );
      CEGUI::WindowManager::setDefaultResourceGroup( "layouts" );
      CEGUI::WidgetLookManager::setDefaultResourceGroup( "looknfeel" );
      CEGUI::ScriptModule::setDefaultResourceGroup( "lua_scripts" );
      }
   

   m_pContext = &CEGUI::System::getSingleton().createGUIContext( s_pRenderer->getDefaultRenderTarget() );
   LoadScheme( "WindowsLook.scheme" );
   SetFont( "UTF8.ttf" );

   m_pRoot = CEGUI::WindowManager::getSingleton().createWindow( "DefaultWindow", "root" );
   m_pContext->setRootWindow( m_pRoot );
   m_pPromptRoot = CEGUI::WindowManager::getSingleton().createWindow( "DefaultWindow", "prompt_root" );
   m_pRoot->addChild( m_pPromptRoot );
   m_pUIRoot = CEGUI::WindowManager::getSingleton().createWindow( "DefaultWindow", "ui_root" );
   m_pRoot->addChild( m_pUIRoot );

   CEGUI::Window* pTestWindow =  CEGUI::WindowManager::getSingleton().createWindow(  "WindowsLook/FrameWindow", "Dialog"  );
   m_pPromptRoot->addChild( pTestWindow );
   CEGUI::WindowManager::getSingleton().destroyWindow( pTestWindow );
   
   }

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Crash when calling destroyWindow

Postby YaronCT » Sun Apr 03, 2016 13:28

moron_venom: This has been fixed, plz try the latest branch "0.8" from the cegui Mercurial repository.

Ident: yeah, I think we better make a new release quickly..

moron_venom
Just popping in
Just popping in
Posts: 8
Joined: Sun Apr 03, 2016 12:56

Re: Crash when calling destroyWindow

Postby moron_venom » Sun Apr 03, 2016 14:05

yaronct wrote:moron_venom: This has been fixed, plz try the latest branch "0.8" from the cegui Mercurial repository.

Ident: yeah, I think we better make a new release quickly..


Sorry, I not so sure which branch should I download.

https://bitbucket.org/cegui/cegui/branch/v0-8 is this the one you mentioned?

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Crash when calling destroyWindow

Postby YaronCT » Sun Apr 03, 2016 14:07

Ah yes, sorry, that branch is called "v0-8".

moron_venom
Just popping in
Just popping in
Posts: 8
Joined: Sun Apr 03, 2016 12:56

Re: Crash when calling destroyWindow

Postby moron_venom » Mon Apr 04, 2016 02:49

yaronct wrote:Ah yes, sorry, that branch is called "v0-8".


It seems like the source in branch is quite different from the released stable source.

I got many errors while building the solution. Also, it has different CMAKE configuration and projects in buildall project.

Any suggestion? Or I should use 0.8.4 instead?

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Crash when calling destroyWindow

Postby YaronCT » Mon Apr 04, 2016 05:42

moron_venom: the "v0-8" shouldn't b very different from the 0.8.5 as we've released 0.8.5 just recently, and in general there shouldn't be a problem building "v0-8". If u wish, we can try and help u with the build problems.

But, if u really want to, u can just apply the needed patch yourself: in 0.8.5 in "Window.cpp", replace "Window::destroy" with the "Window::destroy" from v0-8, which is:

Code: Select all

//----------------------------------------------------------------------------//
void Window::destroy(void)
{
    // because we know that people do not read the API ref properly,
    // here is some protection to ensure that WindowManager does the
    // destruction and not anyone else.
    WindowManager& wmgr = WindowManager::getSingleton();

    if (wmgr.isAlive(this))
    {
        wmgr.destroyWindow(this);

        // now return, the rest of what we need to do will happen
        // once WindowManager re-calls this method.
        return;
    }

    // double check we are detached from parent
    if (d_parent)
        d_parent->removeChild(this);

    // signal our imminent destruction
    WindowEventArgs args(this);
    onDestructionStarted(args);

    releaseInput();

    // let go of the tooltip if we have it
    Tooltip* const tip = getTooltip();
    if (tip && tip->getTargetWindow()==this)
        tip->setTargetWindow(0);

    // ensure custom tooltip is cleaned up
    setTooltip(static_cast<Tooltip*>(0));
   


    // clean up looknfeel related things
    if (!d_lookName.empty())
    {
        d_windowRenderer->onLookNFeelUnassigned();
        WidgetLookManager::getSingleton().getWidgetLook(d_lookName).
            cleanUpWidget(*this);
    }

    // free any assigned WindowRenderer
    if (d_windowRenderer != 0)
    {
        d_windowRenderer->onDetach();
        WindowRendererManager::getSingleton().
            destroyWindowRenderer(d_windowRenderer);
        d_windowRenderer = 0;
    }

    cleanupChildren();

    releaseRenderingWindow();
    invalidate();
}


I certainly wouldn't go back in version.


Return to “Help”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 6 guests