From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Tue, 25 Jan 2005 13:58:01 +0000 (+0000)
Subject: fixed memory leak with client data when using DeleteAllItems() (bug 1107215)
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7a46263195573a6e310b6ca74bd0ced613a56597

fixed memory leak with client data when using DeleteAllItems() (bug 1107215)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp
index 0eeef36021..25c10a2929 100644
--- a/src/msw/listctrl.cpp
+++ b/src/msw/listctrl.cpp
@@ -1232,7 +1232,7 @@ bool wxListCtrl::DeleteItem(long item)
         return false;
     }
 
-    m_count -= 1;
+    m_count--;
     wxASSERT_MSG( m_count == ListView_GetItemCount(GetHwnd()),
                   wxT("m_count should match ListView_GetItemCount"));
 
@@ -1264,7 +1264,6 @@ bool wxListCtrl::DeleteItem(long item)
 // Deletes all items
 bool wxListCtrl::DeleteAllItems()
 {
-	m_count = 0;
     return ListView_DeleteAllItems(GetHwnd()) != 0;
 }
 
@@ -1819,7 +1818,8 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
         // ignored for efficiency.  It is done here because the internal data is in the
         // process of being deleted so we don't want to try and access it below.
         if ( m_ignoreChangeMessages &&
-             ( (nmLV->hdr.code == LVN_ITEMCHANGED) || (nmLV->hdr.code == LVN_ITEMCHANGING)))
+             ( (nmLV->hdr.code == LVN_ITEMCHANGED) ||
+               (nmLV->hdr.code == LVN_ITEMCHANGING)) )
         {
             return true;
         }