From 34ce86a8f50c1dd4c8b2cc5c94bbd1f13a38c0a9 Mon Sep 17 00:00:00 2001 From: Maintainer_ <131448485+FoxLoveFire@users.noreply.github.com> Date: Fri, 5 Jan 2024 04:39:56 +0500 Subject: [PATCH] Fix GameUI text staying visible during shutdown. (#14197) --- src/client/game.cpp | 3 +++ src/client/gameui.cpp | 33 +++++++++++++++++++++++++++++++++ src/client/gameui.h | 1 + 3 files changed, 37 insertions(+) diff --git a/src/client/game.cpp b/src/client/game.cpp index 32c4bbcabd04..1a538a7f563e 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1333,6 +1333,9 @@ void Game::shutdown() if (formspec) formspec->quitMenu(); + // Clear text when exiting. + m_game_ui->clearText(); + #ifdef HAVE_TOUCHSCREENGUI g_touchscreengui->hide(); #endif diff --git a/src/client/gameui.cpp b/src/client/gameui.cpp index a4ab44e60c89..3ea1e2624c87 100644 --- a/src/client/gameui.cpp +++ b/src/client/gameui.cpp @@ -334,3 +334,36 @@ void GameUI::deleteFormspec() m_formname.clear(); } + +void GameUI::clearText() +{ + if (m_guitext_chat) { + m_guitext_chat->remove(); + m_guitext_chat = nullptr; + } + + if (m_guitext) { + m_guitext->remove(); + m_guitext = nullptr; + } + + if (m_guitext2) { + m_guitext2->remove(); + m_guitext2 = nullptr; + } + + if (m_guitext_info) { + m_guitext_info->remove(); + m_guitext_info = nullptr; + } + + if (m_guitext_status) { + m_guitext_status->remove(); + m_guitext_status = nullptr; + } + + if (m_guitext_profiler) { + m_guitext_profiler->remove(); + m_guitext_profiler = nullptr; + } +} diff --git a/src/client/gameui.h b/src/client/gameui.h index 589328a286e0..f97ee7e50cd7 100644 --- a/src/client/gameui.h +++ b/src/client/gameui.h @@ -106,6 +106,7 @@ class GameUI const std::string &getFormspecName() { return m_formname; } GUIFormSpecMenu *&getFormspecGUI() { return m_formspec; } void deleteFormspec(); + void clearText(); private: Flags m_flags;