Skip to content

Commit

Permalink
Fix GameUI text staying visible during shutdown. (#14197)
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxLoveFire committed Jan 4, 2024
1 parent 05a53cd commit 34ce86a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/client/game.cpp
Expand Up @@ -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
Expand Down
33 changes: 33 additions & 0 deletions src/client/gameui.cpp
Expand Up @@ -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;
}
}
1 change: 1 addition & 0 deletions src/client/gameui.h
Expand Up @@ -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;
Expand Down

0 comments on commit 34ce86a

Please sign in to comment.