summaryrefslogtreecommitdiff
path: root/plugins/Toaster/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-01-02 17:49:03 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-01-02 17:49:03 +0300
commit4025097777df8759c1f0f78bfc2968676bb4250a (patch)
tree4e4def2d303a8e36b3c06280a663406b9603edad /plugins/Toaster/src
parentc1918e3cc32b2f77ddb18f9d55804067c78399e8 (diff)
fixes #3282 (Toaster: падение при создании большого числа всплывающих окон)
Diffstat (limited to 'plugins/Toaster/src')
-rw-r--r--plugins/Toaster/src/toast_notification.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/Toaster/src/toast_notification.cpp b/plugins/Toaster/src/toast_notification.cpp
index 1b22086b9e..d9ecb3a564 100644
--- a/plugins/Toaster/src/toast_notification.cpp
+++ b/plugins/Toaster/src/toast_notification.cpp
@@ -26,13 +26,18 @@ ToastNotification::ToastNotification(
void *pData)
: _text(text), _caption(caption), _imagePath(imagePath), _hContact(hContact), _pfnPopupProc(pWndProc), _pvPopupData(pData)
{
- {
- mir_cslock lck(csNotifications);
+ { mir_cslock lck(csNotifications);
lstNotifications.insert(this);
}
- Windows::Foundation::GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), &notificationManager);
- notificationManager->CreateToastNotifierWithId(StringReferenceWrapper(::AppUserModelID).Get(), &notifier);
- Create(&notification);
+
+ if (FAILED(Windows::Foundation::GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), &notificationManager)))
+ return;
+
+ if (FAILED(notificationManager->CreateToastNotifierWithId(StringReferenceWrapper(::AppUserModelID).Get(), &notifier)))
+ return;
+
+ if (FAILED(Create(&notification)))
+ return;
notification->add_Activated(Callback<ToastActivationHandler>(this, &ToastNotification::OnActivate).Get(), &_ertActivated);
notification->add_Dismissed(Callback<ToastDismissHandler>(this, &ToastNotification::OnDismiss).Get(), &_ertDismissed);