From ee7bcb842c244d92d3075819d8dae344088bfa4c Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Tue, 27 Apr 2010 13:26:45 +0000 Subject: [PATCH] Safeguard against redundant registration of the same wxAnyValueType instance (by storing pointers in a set instead of a vector) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64159 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/any.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/common/any.cpp b/src/common/any.cpp index ac960455b3..79aed46067 100644 --- a/src/common/any.cpp +++ b/src/common/any.cpp @@ -28,6 +28,7 @@ #include "wx/vector.h" #include "wx/module.h" #include "wx/hashmap.h" +#include "wx/hashset.h" using namespace wxPrivate; @@ -45,6 +46,11 @@ WX_DECLARE_HASH_MAP(wxAnyValueType*, #endif +WX_DECLARE_HASH_SET(wxAnyValueType*, + wxPointerHash, + wxPointerEqual, + wxAnyValueTypePtrSet); + // // Helper class to manage wxAnyValueType instances and and other // related global variables (such as wxAny<->wxVariant type association). @@ -65,13 +71,20 @@ public: #if wxUSE_VARIANT m_anyToVariant.clear(); #endif - for ( size_t i=0; i m_valueTypes; + wxAnyValueTypePtrSet m_valueTypes; #if wxUSE_VARIANT wxAnyTypeToVariantDataFactoryMap m_anyToVariant; wxVector m_anyToVariantRegs;