fix: remove lingering data when notifications autodismiss on Windows 7 (#18401)

This commit is contained in:
Robert Säll 2019-06-12 01:39:25 +02:00 committed by Cheng Zhao
parent 0e3ab7c128
commit 0bf83b7183
2 changed files with 12 additions and 2 deletions

View file

@ -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: {

View file

@ -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);