diff --git a/es-core/src/utils/PlatformUtil.cpp b/es-core/src/utils/PlatformUtil.cpp index 5ae0dc12b..d0399445d 100644 --- a/es-core/src/utils/PlatformUtil.cpp +++ b/es-core/src/utils/PlatformUtil.cpp @@ -387,6 +387,9 @@ namespace Utils LOG(LogError) << "Critical - Performing emergency shutdown..."; Scripting::fireEvent("quit"); + while (Window::getInstance()->getGuiStackSize() > 1 && + Window::getInstance()->peekGui() != nullptr) + delete Window::getInstance()->peekGui(); Window::getInstance()->deinit(); Log::flush();