mirror of https://github.com/Icinga/icinga2.git
Merge pull request #9123 from Icinga/bugfix/icinga2-crashes-when-sending-notifications-8186
Avoid "type" key in dicts being part of object state attrs
This commit is contained in:
commit
6390911262
|
@ -75,7 +75,7 @@ void Checkable::SendNotifications(NotificationType type, const CheckResult::Ptr&
|
|||
<< "Notification '" << notification->GetName() << "': there are some stashed notifications. Stashing notification to preserve order.";
|
||||
|
||||
stashedNotifications->Add(new Dictionary({
|
||||
{"type", type},
|
||||
{"notification_type", type},
|
||||
{"cr", cr},
|
||||
{"force", force},
|
||||
{"reminder", false},
|
||||
|
@ -100,7 +100,7 @@ void Checkable::SendNotifications(NotificationType type, const CheckResult::Ptr&
|
|||
<< "Notification '" << notification->GetName() << "': object authority hasn't been updated, yet. Stashing notification.";
|
||||
|
||||
notification->GetStashedNotifications()->Add(new Dictionary({
|
||||
{"type", type},
|
||||
{"notification_type", type},
|
||||
{"cr", cr},
|
||||
{"force", force},
|
||||
{"reminder", false},
|
||||
|
|
|
@ -183,12 +183,15 @@ void NotificationComponent::NotificationTimerHandler()
|
|||
ObjectLock olock(unstashedNotifications);
|
||||
|
||||
for (Dictionary::Ptr unstashedNotification : unstashedNotifications) {
|
||||
if (!unstashedNotification)
|
||||
continue;
|
||||
|
||||
try {
|
||||
Log(LogNotice, "NotificationComponent")
|
||||
<< "Attempting to send stashed notification '" << notificationName << "'.";
|
||||
|
||||
notification->BeginExecuteNotification(
|
||||
(NotificationType)(int)unstashedNotification->Get("type"),
|
||||
(NotificationType)(int)unstashedNotification->Get("notification_type"),
|
||||
(CheckResult::Ptr)unstashedNotification->Get("cr"),
|
||||
(bool)unstashedNotification->Get("force"),
|
||||
(bool)unstashedNotification->Get("reminder"),
|
||||
|
|
Loading…
Reference in New Issue