Listview S6

Dimitrie O. Paun dpaun at rogers.com
Thu Oct 17 00:23:03 CDT 2002


Should fix David's problem.

ChangeLog
  Deal with sparsely populated listviews
  Crash on internal corruption.

--- dlls/comctl32/listview.c.S5	Thu Oct 17 00:51:03 2002
+++ dlls/comctl32/listview.c	Thu Oct 17 01:20:36 2002
@@ -5870,7 +5870,8 @@
 		           is_sorted ? infoPtr->nItemCount + 1 : lpLVItem->iItem, 
 			   hdpaSubItems );
     if (nItem == -1) goto fail;
-    infoPtr->nItemCount++;
+    /* the array may be sparsly populated, we can't just increment the count here */
+    infoPtr->nItemCount = infoPtr->hdpaItems->nItemCount;
    
     if (!LISTVIEW_SetItemT(infoPtr, lpLVItem, isW))
 	goto undo;
@@ -5880,13 +5881,7 @@
     {
 	DPA_Sort( infoPtr->hdpaItems, LISTVIEW_InsertCompare, (LPARAM)infoPtr );
 	nItem = DPA_GetPtrIndex( infoPtr->hdpaItems, hdpaSubItems );
-	if (nItem == -1)
-	{
-	    ERR("We can't find the item we just inserted, possible memory corruption.");
-	    /* we can't remove it from the list if we can't find it, so just fail */
-	    /* we don't deallocate memory here, as it will probably cause more problems */
-	    return -1;
-	}
+	assert(nItem != -1);
     }
 
     /* make room for the position, if we are in the right mode */




More information about the wine-patches mailing list