CommonHostInterface: Fix OSD messages not clearing on shutdown

This commit is contained in:
Connor McLaughlin 2021-05-01 13:37:29 +10:00
parent f39a5dcf5d
commit 44f29da40f
3 changed files with 15 additions and 2 deletions

View File

@ -1149,8 +1149,15 @@ void CommonHostInterface::AddOSDMessage(std::string message, float duration /*=
void CommonHostInterface::ClearOSDMessages() void CommonHostInterface::ClearOSDMessages()
{ {
{
std::unique_lock<std::mutex> lock(m_osd_messages_lock); std::unique_lock<std::mutex> lock(m_osd_messages_lock);
m_osd_posted_messages.clear(); m_osd_posted_messages.clear();
}
m_osd_active_messages.clear();
if (IsFullscreenUIEnabled())
ImGuiFullscreen::ClearNotifications();
} }
bool CommonHostInterface::EnumerateOSDMessages(std::function<bool(const std::string&, float)> callback) bool CommonHostInterface::EnumerateOSDMessages(std::function<bool(const std::string&, float)> callback)

View File

@ -1500,6 +1500,11 @@ void AddNotification(float duration, std::string title, std::string text, std::s
s_notifications.push_back(std::move(notif)); s_notifications.push_back(std::move(notif));
} }
void ClearNotifications()
{
s_notifications.clear();
}
void DrawNotifications(ImVec2& position, float spacing) void DrawNotifications(ImVec2& position, float spacing)
{ {
if (s_notifications.empty()) if (s_notifications.empty())

View File

@ -254,5 +254,6 @@ void UpdateBackgroundProgressDialog(const char* str_id, std::string message, s32
void CloseBackgroundProgressDialog(const char* str_id); void CloseBackgroundProgressDialog(const char* str_id);
void AddNotification(float duration, std::string title, std::string text, std::string image_path); void AddNotification(float duration, std::string title, std::string text, std::string image_path);
void ClearNotifications();
} // namespace ImGuiFullscreen } // namespace ImGuiFullscreen