diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index 6161b138a..d2a7f5e55 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -7,6 +7,7 @@ #include "base/json.hpp" #include "base/logger.hpp" #include "base/serializer.hpp" +#include "base/shared.hpp" #include "base/tlsutility.hpp" #include "base/initialize.hpp" #include "base/convert.hpp" @@ -1759,6 +1760,13 @@ void IcingaDB::DowntimeRemovedHandler(const Downtime::Ptr& downtime) } } +struct ATU +{ + String Author; + String Text; + std::set Users; +}; + void IcingaDB::NotificationSentToAllUsersHandler( const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set& users, NotificationType type, const CheckResult::Ptr& cr, const String& author, const String& text @@ -1767,11 +1775,11 @@ void IcingaDB::NotificationSentToAllUsersHandler( auto rws (ConfigType::GetObjectsByType()); if (!rws.empty()) { - auto authorAndText (std::make_shared>(author, text)); + auto atu (Shared::Make(ATU{author, text, users})); for (auto& rw : rws) { - rw->m_WorkQueue.Enqueue([rw, notification, checkable, users, type, cr, authorAndText]() { - rw->SendSentNotification(notification, checkable, users, type, cr, authorAndText->first, authorAndText->second); + rw->m_WorkQueue.Enqueue([rw, notification, checkable, atu, type, cr]() { + rw->SendSentNotification(notification, checkable, atu->Users, type, cr, atu->Author, atu->Text); }); } }