mirror of https://github.com/Icinga/icinga2.git
Merge pull request #8591 from Icinga/bugfix/concurent-notification-send-and-delete
Fix crash when notifications are sent while the notification object is deleted
This commit is contained in:
commit
f1110eb321
|
@ -431,7 +431,11 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
|
|||
<< "Sending " << (reminder ? "reminder " : "") << "'" << NotificationTypeToString(type) << "' notification '"
|
||||
<< notificationName << "' for user '" << userName << "'";
|
||||
|
||||
Utility::QueueAsyncCallback(std::bind(&Notification::ExecuteNotificationHelper, this, type, user, cr, force, author, text));
|
||||
// Explicitly use Notification::Ptr to keep the reference counted while the callback is active
|
||||
Notification::Ptr notification (this);
|
||||
Utility::QueueAsyncCallback([notification, type, user, cr, force, author, text]() {
|
||||
notification->ExecuteNotificationHelper(type, user, cr, force, author, text);
|
||||
});
|
||||
|
||||
/* collect all notified users */
|
||||
allNotifiedUsers.insert(user);
|
||||
|
|
Loading…
Reference in New Issue