webengine/osswebengine/WebCore/dom/StyledElement.cpp
changeset 13 10e98eab6f85
parent 0 dd21522fd290
child 16 a359256acfc6
--- a/webengine/osswebengine/WebCore/dom/StyledElement.cpp	Fri May 08 08:25:06 2009 +0300
+++ b/webengine/osswebengine/WebCore/dom/StyledElement.cpp	Fri Jul 03 15:54:40 2009 +0100
@@ -67,9 +67,27 @@
 //typedef HashMap<MappedAttributeKey, CSSMappedAttributeDeclaration*, MappedAttributeHash, MappedAttributeKeyTraits> MappedAttributeDecls;
 typedef MappedAttributeKey* MappedAttributeKeyPtr;
 typedef HashMap<MappedAttributeKeyPtr, CSSMappedAttributeDeclaration*, MappedAttributeHash, MappedAttributeKeyTraits> MappedAttributeDecls;
+typedef HashMap<MappedAttributeKeyPtr, CSSMappedAttributeDeclaration*, MappedAttributeHash, MappedAttributeKeyTraits>::iterator MappedAttributeDeclsIterator;
 
 static MappedAttributeDecls* mappedAttributeDecls = 0;
 
+struct mappedAttributeCleaner {
+    ~mappedAttributeCleaner() {
+        if( mappedAttributeDecls ) {
+        	MappedAttributeDeclsIterator end = mappedAttributeDecls->end();
+	        for (MappedAttributeDeclsIterator it = mappedAttributeDecls->begin(); it != end; ++it) 
+	        	{
+	        	MappedAttributeKey* obj = (*it).first;
+	        	delete obj;
+	        	}
+	        mappedAttributeDecls->clear();
+            delete mappedAttributeDecls;
+            mappedAttributeDecls = 0;
+        }
+    }
+};
+struct mappedAttributeCleaner mappedAttribute;
+
 CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttributeEntry entryType, Attribute* attr)
 {
     if (!mappedAttributeDecls)