mirror of https://github.com/Icinga/icinga2.git
Bugfix: Missing parent object causes assert in ReplicationComponent::Stop
Fixes #3601
This commit is contained in:
parent
b8fa0aa1f5
commit
e928b1fabf
|
@ -267,11 +267,13 @@ void DynamicObject::Register(void)
|
|||
{
|
||||
assert(Application::IsMainThread());
|
||||
|
||||
DynamicObject::Ptr dobj = GetType()->GetObject(GetName());
|
||||
DynamicType::Ptr dtype = GetType();
|
||||
|
||||
DynamicObject::Ptr dobj = dtype->GetObject(GetName());
|
||||
DynamicObject::Ptr self = GetSelf();
|
||||
assert(!dobj || dobj == self);
|
||||
|
||||
GetType()->RegisterObject(self);
|
||||
dtype->RegisterObject(self);
|
||||
|
||||
OnRegistered(GetSelf());
|
||||
|
||||
|
@ -287,10 +289,12 @@ void DynamicObject::Unregister(void)
|
|||
{
|
||||
assert(Application::IsMainThread());
|
||||
|
||||
if (!GetType()->GetObject(GetName()))
|
||||
DynamicType::Ptr dtype = GetType();
|
||||
|
||||
if (!dtype || !dtype->GetObject(GetName()))
|
||||
return;
|
||||
|
||||
GetType()->UnregisterObject(GetSelf());
|
||||
dtype->UnregisterObject(GetSelf());
|
||||
|
||||
OnUnregistered(GetSelf());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue