This fixes a crash that would happen when DeleteAllItems is called

when some items have attributes.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15902 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-06-21 01:57:17 +00:00
parent 5a6b32cc16
commit 73d8c5fd76

View File

@@ -367,9 +367,18 @@ void wxListCtrl::FreeAllInternalData()
{ {
wxListItemInternalData *data = GetInternalData(this, i); wxListItemInternalData *data = GetInternalData(this, i);
if (data) if (data)
{
delete data; delete data;
}; LV_ITEM item;
}; memset(&item, 0, sizeof(item));
item.iItem = i;
item.mask = LVIF_PARAM;
item.lParam = (LPARAM) 0;
BOOL result = ListView_SetItem(GetHwnd(), &item);
}
}
m_AnyInternalData = FALSE;
}
} }
wxListCtrl::~wxListCtrl() wxListCtrl::~wxListCtrl()
@@ -1196,6 +1205,7 @@ bool wxListCtrl::DeleteItem(long item)
// Deletes all items // Deletes all items
bool wxListCtrl::DeleteAllItems() bool wxListCtrl::DeleteAllItems()
{ {
FreeAllInternalData();
return ListView_DeleteAllItems(GetHwnd()) != 0; return ListView_DeleteAllItems(GetHwnd()) != 0;
} }