[Bug 17478] New: Fix dpa warning from comctl32/listview.c

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Feb 20 03:07:22 CST 2009


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 at winehq.org
        ReportedBy: peter.schauer at 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");
 }


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list