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
This commit is contained in:
Vadim Zeitlin
2005-01-25 13:58:01 +00:00
parent 5fae0f97a1
commit 7a46263195

View File

@@ -1232,7 +1232,7 @@ bool wxListCtrl::DeleteItem(long item)
return false; return false;
} }
m_count -= 1; m_count--;
wxASSERT_MSG( m_count == ListView_GetItemCount(GetHwnd()), wxASSERT_MSG( m_count == ListView_GetItemCount(GetHwnd()),
wxT("m_count should match ListView_GetItemCount")); wxT("m_count should match ListView_GetItemCount"));
@@ -1264,7 +1264,6 @@ bool wxListCtrl::DeleteItem(long item)
// Deletes all items // Deletes all items
bool wxListCtrl::DeleteAllItems() bool wxListCtrl::DeleteAllItems()
{ {
m_count = 0;
return ListView_DeleteAllItems(GetHwnd()) != 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 // 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. // process of being deleted so we don't want to try and access it below.
if ( m_ignoreChangeMessages && 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; return true;
} }