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:
@@ -367,9 +367,18 @@ void wxListCtrl::FreeAllInternalData()
|
||||
{
|
||||
wxListItemInternalData *data = GetInternalData(this, i);
|
||||
if (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()
|
||||
@@ -1196,6 +1205,7 @@ bool wxListCtrl::DeleteItem(long item)
|
||||
// Deletes all items
|
||||
bool wxListCtrl::DeleteAllItems()
|
||||
{
|
||||
FreeAllInternalData();
|
||||
return ListView_DeleteAllItems(GetHwnd()) != 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user