[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    [PATCH 1/4 v2] user32: Fix itemData passed in ListBox WM_MEASUREITEM message
From:       Piotr Caban <piotr () codeweavers ! com>
Date:       2018-02-28 16:36:51
Message-ID: 3a076862-0b9f-4d80-7689-53f726a2e073 () codeweavers ! com
[Download RAW message or body]

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
---
v2:
  - fixed test failures

  dlls/user32/listbox.c | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)



["0001-user32-Fix-itemData-passed-in-ListBox-WM_MEASUREITEM-m.txt" (text/x-patch)]

diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index f6b936ab90..8df67634d3 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -1538,7 +1538,7 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index,
         RtlMoveMemory( item + 1, item,
                        (descr->nb_items - index) * sizeof(LB_ITEMDATA) );
     item->str      = str;
-    item->data     = data;
+    item->data     = HAS_STRINGS(descr) ? 0 : data;
     item->height   = 0;
     item->selected = FALSE;
     descr->nb_items++;
@@ -1553,7 +1553,7 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index,
         mis.CtlType    = ODT_LISTBOX;
         mis.CtlID      = id;
         mis.itemID     = index;
-        mis.itemData   = descr->items[index].data;
+        mis.itemData   = data;
         mis.itemHeight = descr->item_height;
         SendMessageW( descr->owner, WM_MEASUREITEM, id, (LPARAM)&mis );
         item->height = mis.itemHeight ? mis.itemHeight : 1;
@@ -1594,7 +1594,6 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index,
 static LRESULT LISTBOX_InsertString( LB_DESCR *descr, INT index, LPCWSTR str )
 {
     LPWSTR new_str = NULL;
-    ULONG_PTR data = 0;
     LRESULT ret;
 
     if (HAS_STRINGS(descr))
@@ -1608,10 +1607,9 @@ static LRESULT LISTBOX_InsertString( LB_DESCR *descr, INT index, LPCWSTR str )
         }
         strcpyW(new_str, str);
     }
-    else data = (ULONG_PTR)str;
 
     if (index == -1) index = descr->nb_items;
-    if ((ret = LISTBOX_InsertItem( descr, index, new_str, data )) != 0)
+    if ((ret = LISTBOX_InsertItem( descr, index, new_str, (ULONG_PTR)str )) != 0)
     {
         HeapFree( GetProcessHeap(), 0, new_str );
         return ret;


[Attachment #4 (text/plain)]




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic