[icinga-checkins] icinga.org: icinga2/master: Bugfix: Missing parent object causes assert in ReplicationComponent::Stop

git at icinga.org git at icinga.org
Fri Feb 1 11:47:04 CET 2013


Module: icinga2
Branch: master
Commit: e928b1fabf697aa9bc70094ac229c0d9c3457f2d
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=e928b1fabf697aa9bc70094ac229c0d9c3457f2d

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Feb  1 11:46:52 2013 +0100

Bugfix: Missing parent object causes assert in ReplicationComponent::Stop

Fixes #3601

---

 lib/base/dynamicobject.cpp |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/base/dynamicobject.cpp b/lib/base/dynamicobject.cpp
index 807c316..dcec7be 100644
--- a/lib/base/dynamicobject.cpp
+++ b/lib/base/dynamicobject.cpp
@@ -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());
 }





More information about the icinga-checkins mailing list