From 0bb2cb3d998cfb6a3a98e469807b7a0e5f55ca15 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 28 Feb 2018 17:37:10 +0100 Subject: [PATCH] comctl32: Fix itemData passed in ListBox WM_MEASUREITEM message. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/comctl32/listbox.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index 3184e200989..94712fd1c80 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -1533,7 +1533,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++; @@ -1548,7 +1548,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; @@ -1589,7 +1589,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)) @@ -1603,10 +1602,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;