From 44f29da40fe2f25185600569cedfef33b5d69602 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 1 May 2021 13:37:29 +1000 Subject: [PATCH] CommonHostInterface: Fix OSD messages not clearing on shutdown --- src/frontend-common/common_host_interface.cpp | 11 +++++++++-- src/frontend-common/imgui_fullscreen.cpp | 5 +++++ src/frontend-common/imgui_fullscreen.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index e0200f827..870b40d91 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -1149,8 +1149,15 @@ void CommonHostInterface::AddOSDMessage(std::string message, float duration /*= void CommonHostInterface::ClearOSDMessages() { - std::unique_lock lock(m_osd_messages_lock); - m_osd_posted_messages.clear(); + { + std::unique_lock lock(m_osd_messages_lock); + m_osd_posted_messages.clear(); + } + + m_osd_active_messages.clear(); + + if (IsFullscreenUIEnabled()) + ImGuiFullscreen::ClearNotifications(); } bool CommonHostInterface::EnumerateOSDMessages(std::function callback) diff --git a/src/frontend-common/imgui_fullscreen.cpp b/src/frontend-common/imgui_fullscreen.cpp index 15f62375f..a32330814 100644 --- a/src/frontend-common/imgui_fullscreen.cpp +++ b/src/frontend-common/imgui_fullscreen.cpp @@ -1500,6 +1500,11 @@ void AddNotification(float duration, std::string title, std::string text, std::s s_notifications.push_back(std::move(notif)); } +void ClearNotifications() +{ + s_notifications.clear(); +} + void DrawNotifications(ImVec2& position, float spacing) { if (s_notifications.empty()) diff --git a/src/frontend-common/imgui_fullscreen.h b/src/frontend-common/imgui_fullscreen.h index 135a170de..b75a87575 100644 --- a/src/frontend-common/imgui_fullscreen.h +++ b/src/frontend-common/imgui_fullscreen.h @@ -254,5 +254,6 @@ void UpdateBackgroundProgressDialog(const char* str_id, std::string message, s32 void CloseBackgroundProgressDialog(const char* str_id); void AddNotification(float duration, std::string title, std::string text, std::string image_path); +void ClearNotifications(); } // namespace ImGuiFullscreen