]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for [ 1044879 ] wxMSW 2.5.3: memleaks in listctrl.cpp and bug in listctrl sample
authorRyan Norton <wxprojects@comcast.net>
Sat, 6 Nov 2004 23:49:28 +0000 (23:49 +0000)
committerRyan Norton <wxprojects@comcast.net>
Sat, 6 Nov 2004 23:49:28 +0000 (23:49 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30325 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/listctrl/listtest.cpp
src/msw/listctrl.cpp

index 59ff8c0a97bb415872a9431b5e22d3b184baae3d..11f2dab732ff2fb3a9421e4ce4c12d893996c1ac 100644 (file)
@@ -656,10 +656,12 @@ void MyFrame::OnDeleteAll(wxCommandEvent& WXUNUSED(event))
 {
     wxStopWatch sw;
 
+    size_t itemCount = m_listCtrl->GetItemCount();
+
     m_listCtrl->DeleteAllItems();
 
     m_logWindow->WriteText(wxString::Format(_T("Deleting %d items took %ld ms\n"),
-                                            m_listCtrl->GetItemCount(),
+                                            itemCount,
                                             sw.Time()));
 }
 
index d933639972a2364658160e649a19fe3eb3aa4e7a..0d5621a969a2bb22e01cf19d518a4debe8158f77 100644 (file)
@@ -480,6 +480,8 @@ void wxListCtrl::FreeAllInternalData()
         m_ignoreChangeMessages = false;
 
         m_AnyInternalData = false;
+
+        m_count = 0;
     }
 }
 
@@ -1917,7 +1919,6 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                 break;
 
             case LVN_DELETEALLITEMS:
-                m_count = 0;
                 eventType = wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS;
                 event.m_itemIndex = -1;
                 break;