From 0bf83b7183c2bd9883a3af8e063e6ead372dddb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20S=C3=A4ll?= Date: Wed, 12 Jun 2019 01:39:25 +0200 Subject: [PATCH] fix: remove lingering data when notifications autodismiss on Windows 7 (#18401) --- .../win/win32_desktop_notifications/toast.cc | 10 ++++++++-- atom/browser/notifications/win/win32_notification.cc | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/atom/browser/notifications/win/win32_desktop_notifications/toast.cc b/atom/browser/notifications/win/win32_desktop_notifications/toast.cc index 8bab5553e36b..1ee159a97ea1 100644 --- a/atom/browser/notifications/win/win32_desktop_notifications/toast.cc +++ b/atom/browser/notifications/win/win32_desktop_notifications/toast.cc @@ -270,10 +270,16 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd, case WM_MOUSEACTIVATE: return MA_NOACTIVATE; - case WM_TIMER: + case WM_TIMER: { if (wparam == TimerID_AutoDismiss) { - Get(hwnd)->AutoDismiss(); + auto* inst = Get(hwnd); + + Notification notification(inst->data_); + inst->data_->controller->OnNotificationDismissed(notification); + + inst->AutoDismiss(); } + } return 0; case WM_LBUTTONDOWN: { diff --git a/atom/browser/notifications/win/win32_notification.cc b/atom/browser/notifications/win/win32_notification.cc index aba61f491017..b7a48317d82d 100644 --- a/atom/browser/notifications/win/win32_notification.cc +++ b/atom/browser/notifications/win/win32_notification.cc @@ -47,8 +47,12 @@ void Win32Notification::Show(const NotificationOptions& options) { if (existing) { existing->tag_.clear(); + this->notification_ref_ = std::move(existing->notification_ref_); this->notification_ref_.Set(options.title, options.msg, image); + // Need to remove the entry in the notifications set that + // NotificationPresenter is holding + existing->Destroy(); } else { this->notification_ref_ = presenter->AddNotification(options.title, options.msg, image);