diff options
author | George Hazan <ghazan@miranda.im> | 2023-01-02 17:49:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-01-02 17:49:03 +0300 |
commit | 4025097777df8759c1f0f78bfc2968676bb4250a (patch) | |
tree | 4e4def2d303a8e36b3c06280a663406b9603edad /plugins/Toaster/src | |
parent | c1918e3cc32b2f77ddb18f9d55804067c78399e8 (diff) |
fixes #3282 (Toaster: падение при создании большого числа всплывающих окон)
Diffstat (limited to 'plugins/Toaster/src')
-rw-r--r-- | plugins/Toaster/src/toast_notification.cpp | 15 |
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(), ¬ificationManager);
- notificationManager->CreateToastNotifierWithId(StringReferenceWrapper(::AppUserModelID).Get(), ¬ifier);
- Create(¬ification);
+
+ if (FAILED(Windows::Foundation::GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), ¬ificationManager)))
+ return;
+
+ if (FAILED(notificationManager->CreateToastNotifierWithId(StringReferenceWrapper(::AppUserModelID).Get(), ¬ifier)))
+ return;
+
+ if (FAILED(Create(¬ification)))
+ return;
notification->add_Activated(Callback<ToastActivationHandler>(this, &ToastNotification::OnActivate).Get(), &_ertActivated);
notification->add_Dismissed(Callback<ToastDismissHandler>(this, &ToastNotification::OnDismiss).Get(), &_ertDismissed);
|