Duplicate selected items list in LISTVIEW_RemoveAllSelections to

prevent infinite loops.
This commit is contained in:
Mike McCormack 2002-10-16 19:56:06 +00:00 committed by Alexandre Julliard
parent 3dd4dabffb
commit bcfffe7b08
1 changed files with 10 additions and 8 deletions

View File

@ -2375,7 +2375,8 @@ static LRESULT LISTVIEW_RemoveAllSelections(LISTVIEW_INFO *infoPtr, INT nSkipIte
{
LVITEMW lvItem;
RANGE *sel;
INT i;
INT i, pos;
HDPA clone;
if (infoPtr->bRemovingAllSelections) return TRUE;
@ -2386,16 +2387,17 @@ static LRESULT LISTVIEW_RemoveAllSelections(LISTVIEW_INFO *infoPtr, INT nSkipIte
lvItem.state = 0;
lvItem.stateMask = LVIS_SELECTED;
do
/* need to clone the DPA because callbacks can change it */
clone = DPA_Clone(infoPtr->hdpaSelectionRanges, NULL);
for ( pos = 0; (sel = DPA_GetPtr(clone, pos)); pos++ )
{
sel = DPA_GetPtr(infoPtr->hdpaSelectionRanges, 0);
if (!sel) continue;
if (infoPtr->hdpaSelectionRanges->nItemCount == 1 &&
sel->lower == nSkipItem && sel->upper == nSkipItem) break;
for(i = sel->lower; i <= sel->upper; i++)
if (i != nSkipItem) LISTVIEW_SetItemState(infoPtr, i, &lvItem);
{
if (i != nSkipItem)
LISTVIEW_SetItemState(infoPtr, i, &lvItem);
}
while (infoPtr->hdpaSelectionRanges->nItemCount > 0);
}
DPA_Destroy(clone);
infoPtr->bRemovingAllSelections = FALSE;