Qt: Clear OSD messages on system stop

This commit is contained in:
Connor McLaughlin 2020-08-29 22:19:09 +10:00
parent 914f3ad447
commit 547cc4dbf6
3 changed files with 8 additions and 0 deletions

View File

@ -641,6 +641,7 @@ void QtHostInterface::OnSystemDestroyed()
{ {
CommonHostInterface::OnSystemDestroyed(); CommonHostInterface::OnSystemDestroyed();
ClearOSDMessages();
startBackgroundControllerPollTimer(); startBackgroundControllerPollTimer();
emit emulationStopped(); emit emulationStopped();
} }

View File

@ -830,6 +830,12 @@ void CommonHostInterface::AddOSDMessage(std::string message, float duration /*=
m_osd_messages.push_back(std::move(msg)); m_osd_messages.push_back(std::move(msg));
} }
void CommonHostInterface::ClearOSDMessages()
{
std::unique_lock<std::mutex> lock(m_osd_messages_lock);
m_osd_messages.clear();
}
void CommonHostInterface::DrawOSDMessages() void CommonHostInterface::DrawOSDMessages()
{ {
constexpr ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs | constexpr ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs |

View File

@ -128,6 +128,7 @@ public:
/// Adds OSD messages, duration is in seconds. /// Adds OSD messages, duration is in seconds.
void AddOSDMessage(std::string message, float duration = 2.0f) override; void AddOSDMessage(std::string message, float duration = 2.0f) override;
void ClearOSDMessages();
/// Displays a loading screen with the logo, rendered with ImGui. Use when executing possibly-time-consuming tasks /// Displays a loading screen with the logo, rendered with ImGui. Use when executing possibly-time-consuming tasks
/// such as compiling shaders when starting up. /// such as compiling shaders when starting up.