diff --git a/src/client/game.cpp b/src/client/game.cpp index eb1cf352b..a000dcfdd 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1272,6 +1272,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 a4ab44e60..3ea1e2624 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 589328a28..f97ee7e50 100644 --- a/src/client/gameui.h +++ b/src/client/gameui.h @@ -106,6 +106,7 @@ public: const std::string &getFormspecName() { return m_formname; } GUIFormSpecMenu *&getFormspecGUI() { return m_formspec; } void deleteFormspec(); + void clearText(); private: Flags m_flags;