http://bugs.winehq.org/show_bug.cgi?id=17478
Summary: Fix dpa warning from comctl32/listview.c Product: Wine Version: 1.1.15 Platform: All OS/Version: All Status: UNCONFIRMED Severity: normal Priority: P2 Component: comctl32 AssignedTo: wine-bugs@winehq.org ReportedBy: peter.schauer@mytum.de
Created an attachment (id=19571) --> (http://bugs.winehq.org/attachment.cgi?id=19571) Patch for listview.c ranges_assert
This patch fixes a small glitch in listview.c which causes a
warn:dpa:not enough pointers in array (0 vs 0)
warning from DPA_GetPtr.
It happens when LISTVIEW_DeselectAllSkipItem creates an empty range and then calls ranges_additem to add one item to the range. ranges_additem calls ranges_add which calls ranges_check(ranges, "before add"), effectively calling ranges_assert. And ranges_assert calls DPA_GetPtr(ranges->hdpa, 0), accessing the first element in the empty range, which triggers the warning.
Here is a patch without whitespace changes to make it more readable, the proper patch is in the attachment:
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index b8545fd..578482b 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -2605,8 +2605,9 @@ static void ranges_assert(RANGES ranges, LPCSTR desc, const char *func, int line assert (ranges); assert (DPA_GetPtrCount(ranges->hdpa) >= 0); ranges_dump(ranges); - prev = DPA_GetPtr(ranges->hdpa, 0); if (DPA_GetPtrCount(ranges->hdpa) > 0) + { + prev = DPA_GetPtr(ranges->hdpa, 0); assert (prev->lower >= 0 && prev->lower < prev->upper); for (i = 1; i < DPA_GetPtrCount(ranges->hdpa); i++) { @@ -2615,6 +2616,7 @@ static void ranges_assert(RANGES ranges, LPCSTR desc, const char *func, int line assert (curr->lower < curr->upper); prev = curr; } + } TRACE("--- Done checking---\n"); }