[icinga-checkins] icinga.org: icinga2/master: Bug: clearing attributes should only reset their value and tx rather than deleting them entirely

git at icinga.org git at icinga.org
Fri Feb 1 19:02:19 CET 2013


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

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Feb  1 19:01:51 2013 +0100

Bug: clearing attributes should only reset their value and tx rather than deleting them entirely

Fixes #3604

---

 lib/base/dynamicobject.cpp |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/lib/base/dynamicobject.cpp b/lib/base/dynamicobject.cpp
index d00d7f3..6e706d8 100644
--- a/lib/base/dynamicobject.cpp
+++ b/lib/base/dynamicobject.cpp
@@ -215,17 +215,13 @@ bool DynamicObject::HasAttribute(const String& name) const
 
 void DynamicObject::ClearAttributesByType(DynamicAttributeType type)
 {
-	DynamicObject::AttributeIterator prev, at;
-	for (at = m_Attributes.begin(); at != m_Attributes.end(); ) {
-		if (at->second.Type == type) {
-			prev = at;
-			at++;
-			m_Attributes.erase(prev);
-
+	DynamicObject::AttributeIterator at;
+	for (at = m_Attributes.begin(); at != m_Attributes.end(); at++) {
+		if (at->second.Type != type)
 			continue;
-		}
 
-		at++;
+		at->second.Tx = 0;
+		at->second.Data = Empty;
 	}
 }
 





More information about the icinga-checkins mailing list