Re: listview R5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dimi,

It appears we need to duplicate the selected items DPA when doing 
RemoveAllSelections because some applications change on 
LVN_ITEMCHANGED/LVN_ITEMCHANGING notifications.

This applies after Dimi's listview R5 patch.

Mike


ChangeLog:
* duplicate Selected items list in LISTVIEW_RemoveAllSelections to 
prevent infinite loops
--- dlls/comctl32/listview.c	Thu Oct 17 11:16:18 2002
+++ dlls/comctl32/listview.c.mike	Thu Oct 17 11:11:36 2002
@@ -2375,7 +2375,8 @@
 {
     LVITEMW lvItem;
     RANGE *sel;
-    INT i;
+    INT i, pos;
+    HDPA clone;
 
     if (infoPtr->bRemovingAllSelections) return TRUE;
 
@@ -2386,16 +2387,17 @@
     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;
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux