Commit 3c5c9b15 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

user32: Fix itemData passed in ListBox WM_MEASUREITEM message.

parent 0a727081
...@@ -1538,7 +1538,7 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index, ...@@ -1538,7 +1538,7 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index,
RtlMoveMemory( item + 1, item, RtlMoveMemory( item + 1, item,
(descr->nb_items - index) * sizeof(LB_ITEMDATA) ); (descr->nb_items - index) * sizeof(LB_ITEMDATA) );
item->str = str; item->str = str;
item->data = data; item->data = HAS_STRINGS(descr) ? 0 : data;
item->height = 0; item->height = 0;
item->selected = FALSE; item->selected = FALSE;
descr->nb_items++; descr->nb_items++;
...@@ -1553,7 +1553,7 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index, ...@@ -1553,7 +1553,7 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index,
mis.CtlType = ODT_LISTBOX; mis.CtlType = ODT_LISTBOX;
mis.CtlID = id; mis.CtlID = id;
mis.itemID = index; mis.itemID = index;
mis.itemData = descr->items[index].data; mis.itemData = data;
mis.itemHeight = descr->item_height; mis.itemHeight = descr->item_height;
SendMessageW( descr->owner, WM_MEASUREITEM, id, (LPARAM)&mis ); SendMessageW( descr->owner, WM_MEASUREITEM, id, (LPARAM)&mis );
item->height = mis.itemHeight ? mis.itemHeight : 1; item->height = mis.itemHeight ? mis.itemHeight : 1;
...@@ -1594,7 +1594,6 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index, ...@@ -1594,7 +1594,6 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index,
static LRESULT LISTBOX_InsertString( LB_DESCR *descr, INT index, LPCWSTR str ) static LRESULT LISTBOX_InsertString( LB_DESCR *descr, INT index, LPCWSTR str )
{ {
LPWSTR new_str = NULL; LPWSTR new_str = NULL;
ULONG_PTR data = 0;
LRESULT ret; LRESULT ret;
if (HAS_STRINGS(descr)) if (HAS_STRINGS(descr))
...@@ -1608,10 +1607,9 @@ static LRESULT LISTBOX_InsertString( LB_DESCR *descr, INT index, LPCWSTR str ) ...@@ -1608,10 +1607,9 @@ static LRESULT LISTBOX_InsertString( LB_DESCR *descr, INT index, LPCWSTR str )
} }
strcpyW(new_str, str); strcpyW(new_str, str);
} }
else data = (ULONG_PTR)str;
if (index == -1) index = descr->nb_items; 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 ); HeapFree( GetProcessHeap(), 0, new_str );
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment