]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/list.cpp
OS/2 updates for statusbar processing and easier VA debugging
[wxWidgets.git] / src / common / list.cpp
index e442699d80a9aa72a8f123e88dbf2d1aec8889f4..0e326ee1f5638d2af008b8f2f32b7b6a9ae9eb0f 100644 (file)
@@ -165,16 +165,46 @@ 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;
 
-    for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() )
-    {
-        Append(node);
+    switch (m_keyType) {
+
+        case wxKEY_INTEGER:
+            {
+                long key;
+                for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() )
+                {
+                    key = node->GetKeyInteger();
+                    Append(key, node->GetData());
+                }
+                break;
+            }
+
+        case wxKEY_STRING:
+            {
+                const wxChar *key;
+                for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() )
+                {
+                    key = node->GetKeyString();
+                    Append(key, node->GetData());
+                }
+                break;
+            }
+
+        default:
+            {
+                for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() )
+                {
+                    Append(node->GetData());
+                }
+                break;
+            }
     }
+
+    wxASSERT_MSG( m_count == list.m_count, _T("logic error in wxList::DoCopy") );
 }
 
 wxListBase::~wxListBase()
@@ -549,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;