]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/hashset.h
fixed memory leak in wxXmlResource introduced when fixing wxVector<> usage (patch...
[wxWidgets.git] / include / wx / hashset.h
index 9c96e5e9e20768d67f174912b0378ffcd2c4227e..fb423ee11ef1a83f985120e19a2ccb92963ebb56 100644 (file)
@@ -23,7 +23,7 @@
 #endif
 
 #define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\
 #endif
 
 #define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\
-    typedef WX_HASH_MAP_NAMESPACE::hash_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME;
+    typedef WX_HASH_MAP_NAMESPACE::hash_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME
 
 #else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP)
 
 
 #else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP)
 
@@ -83,7 +83,7 @@ public:                                                                      \
     /* count() == 0 | 1 */                                                   \
     size_type count( const const_key_type& key )                             \
         { return GetNode( key ) ? 1 : 0; }                                   \
     /* count() == 0 | 1 */                                                   \
     size_type count( const const_key_type& key )                             \
         { return GetNode( key ) ? 1 : 0; }                                   \
-};
+}
 
 #endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP)
 
 
 #endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP)
 
@@ -107,6 +107,11 @@ public:                                                                      \
 //     be called (a decent compiler should give a warning about it, but don't
 //     count on it)!
 #define WX_CLEAR_HASH_SET(type, hashset)                                     \
 //     be called (a decent compiler should give a warning about it, but don't
 //     count on it)!
 #define WX_CLEAR_HASH_SET(type, hashset)                                     \
-    WX_CLEAR_HASH_MAP(type, hashset)
+    {                                                                        \
+        type::iterator it, en;                                               \
+        for( it = (hashset).begin(), en = (hashset).end(); it != en; ++it )  \
+            delete *it;                                                      \
+        (hashset).clear();                                                   \
+    }
 
 #endif // _WX_HASHSET_H_
 
 #endif // _WX_HASHSET_H_