From: Ryan Norton Date: Sat, 6 Nov 2004 23:49:28 +0000 (+0000) Subject: fix for [ 1044879 ] wxMSW 2.5.3: memleaks in listctrl.cpp and bug in listctrl sample X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/fde548e2d25216ccc8380368a2d055cef577adc6?hp=16c0e7305c55853f3a82c56bbc3cb2902f4141ad fix for [ 1044879 ] wxMSW 2.5.3: memleaks in listctrl.cpp and bug in listctrl sample git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30325 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index 59ff8c0a97..11f2dab732 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -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())); } diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index d933639972..0d5621a969 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -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;