]> granicus.if.org Git - icinga2/commitdiff
livestatus: hoststable: lock service object for acknowledgement getters
authorMichael Friedrich <michael.friedrich@netways.de>
Fri, 5 Jul 2013 09:28:05 +0000 (11:28 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 5 Jul 2013 09:28:05 +0000 (11:28 +0200)
refs #4372

components/livestatus/hoststable.cpp

index 35276c69a91cd63da02053731b7f4ee6e20360b7..525f1f3cd7484a7bdc681471a3d6173e9f332e43 100644 (file)
@@ -24,6 +24,7 @@
 #include "icinga/eventcommand.h"
 #include "icinga/timeperiod.h"
 #include "base/dynamictype.h"
+#include "base/objectlock.h"
 #include <boost/foreach.hpp>
 #include <boost/smart_ptr/make_shared.hpp>
 
@@ -420,6 +421,8 @@ Value HostsTable::AcknowledgementTypeAccessor(const Object::Ptr& object)
        if (!hc)
                return Value();
 
+       ObjectLock olock(hc);
+
        return static_cast<int>(hc->GetAcknowledgement());
 }
 
@@ -547,6 +550,8 @@ Value HostsTable::AcknowledgedAccessor(const Object::Ptr& object)
        if (!hc)
                return Value();
 
+       ObjectLock olock(hc);
+
        return (hc->IsAcknowledged() ? 1 : 0);
 }