X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ecf9e593f8f77a9105bfaf6c94aae1baa84020da..7e99520bd3fc092bbbcbc38bb699a0236618ea40:/src/common/list.cpp diff --git a/src/common/list.cpp b/src/common/list.cpp index 9d88dea967..0e326ee1f5 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -165,17 +165,16 @@ void wxListBase::DoCopy(const wxListBase& list) wxASSERT_MSG( !list.m_destroy, wxT("copying list which owns it's elements is a bad idea") ); - m_count = list.m_count; m_destroy = list.m_destroy; m_keyType = list.m_keyType; m_nodeFirst = m_nodeLast = (wxNodeBase *) NULL; switch (m_keyType) { - + case wxKEY_INTEGER: { - long key; + long key; for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) { key = node->GetKeyInteger(); @@ -186,7 +185,7 @@ void wxListBase::DoCopy(const wxListBase& list) case wxKEY_STRING: { - const wxChar *key; + const wxChar *key; for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) { key = node->GetKeyString(); @@ -204,6 +203,8 @@ void wxListBase::DoCopy(const wxListBase& list) break; } } + + wxASSERT_MSG( m_count == list.m_count, _T("logic error in wxList::DoCopy") ); } wxListBase::~wxListBase() @@ -578,6 +579,7 @@ void wxStringList::DoCopy(const wxStringList& other) // Makes new storage for the strings wxStringList::wxStringList (const wxChar *first, ...) { + DeleteContents(TRUE); if ( !first ) return;