mirror of https://github.com/Icinga/icinga2.git
Merge pull request #7154 from Elias481/fix/serializer-object-locking-7003
Lock all kind of Objects during serialization
This commit is contained in:
commit
368383bedd
|
@ -129,6 +129,8 @@ static Object::Ptr SerializeObject(const Object::Ptr& input, int attributeTypes,
|
|||
DictionaryData fields;
|
||||
fields.reserve(type->GetFieldCount() + 1);
|
||||
|
||||
ObjectLock olock(input);
|
||||
|
||||
for (int i = 0; i < type->GetFieldCount(); i++) {
|
||||
Field field = type->GetFieldInfo(i);
|
||||
|
||||
|
@ -140,7 +142,7 @@ static Object::Ptr SerializeObject(const Object::Ptr& input, int attributeTypes,
|
|||
|
||||
Value value = input->GetField(i);
|
||||
stack.Push(field.Name, value);
|
||||
fields.emplace_back(field.Name, SerializeInternal(input->GetField(i), attributeTypes, stack));
|
||||
fields.emplace_back(field.Name, SerializeInternal(value, attributeTypes, stack));
|
||||
stack.Pop();
|
||||
}
|
||||
|
||||
|
|
|
@ -221,6 +221,7 @@ void TimePeriod::Merge(const TimePeriod::Ptr& timeperiod, bool include)
|
|||
void TimePeriod::UpdateRegion(double begin, double end, bool clearExisting)
|
||||
{
|
||||
if (clearExisting) {
|
||||
ObjectLock olock(this);
|
||||
SetSegments(new Array());
|
||||
} else {
|
||||
if (begin < GetValidEnd())
|
||||
|
@ -346,6 +347,8 @@ void TimePeriod::UpdateTimerHandler()
|
|||
|
||||
void TimePeriod::Dump()
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
Array::Ptr segments = GetSegments();
|
||||
|
||||
Log(LogDebug, "TimePeriod")
|
||||
|
|
Loading…
Reference in New Issue