diff --git a/Core/GameEngine/Include/GameClient/Shell.h b/Core/GameEngine/Include/GameClient/Shell.h index a593f3cbcba..262f89c3bc4 100644 --- a/Core/GameEngine/Include/GameClient/Shell.h +++ b/Core/GameEngine/Include/GameClient/Shell.h @@ -131,7 +131,7 @@ class Shell : public SubsystemInterface // pseudo-stack operations for manipulating layouts void push( AsciiString filename, Bool shutdownImmediate = FALSE ); ///< load new screen on top, optionally doing an immediate shutdown void pop(); ///< pop top layout - void popImmediate(); ///< pop now, don't wait for shutdown + void popImmediate(); ///< pop now void showShell( Bool runInit = TRUE ); ///< init the top of stack void hideShell(); ///< shutdown the top of stack WindowLayout *top(); ///< return top layout @@ -161,6 +161,7 @@ class Shell : public SubsystemInterface void construct(); void deconstruct(); + void destroyScreenStack(); ///< tear down all screens without initializing uncovered layouts void linkScreen( WindowLayout *screen ); ///< link screen to list void unlinkScreen( WindowLayout *screen ); ///< remove screen from list diff --git a/Core/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/Core/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index 1b6278d02db..a9a65928861 100644 --- a/Core/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/Core/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -90,12 +90,7 @@ void Shell::construct() //------------------------------------------------------------------------------------------------- void Shell::deconstruct() { - WindowLayout *newTop = top(); - while(newTop) - { - popImmediate(); - newTop = top(); - } + destroyScreenStack(); if(m_background) { @@ -138,6 +133,31 @@ void Shell::deconstruct() } } +//------------------------------------------------------------------------------------------------- +/** TheSuperHackers @bugfix CryoTheRenegade 10/08/2026 Tear down every screen on the stack without initializing uncovered layouts. + * Used when the shell itself is being destroyed. */ +//------------------------------------------------------------------------------------------------- +void Shell::destroyScreenStack() +{ + while( top() ) + { + WindowLayout *screen = top(); + + // do NOT set pending pop, we are going to force a pop after the shutdown is run + m_pendingPop = FALSE; + + Bool immediatePop = TRUE; + screen->runShutdown( &immediatePop ); + + unlinkScreen( screen ); + screen->destroyWindows(); + deleteInstance( screen ); + } + + if (TheIMEManager) + TheIMEManager->detach(); +} + //------------------------------------------------------------------------------------------------- /** Initialize the shell system */ //-------------------------------------------------------------------------------------------------