From ee6ba4e5e9e72e4b756712f1f7e1d53074f7a62d Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 1 Feb 2013 19:01:51 +0100 Subject: [PATCH] Bug: clearing attributes should only reset their value and tx rather than deleting them entirely Fixes #3604 --- lib/base/dynamicobject.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/base/dynamicobject.cpp b/lib/base/dynamicobject.cpp index d00d7f3df..6e706d868 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; } }