Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/comctl32/listbox.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index f2d0615bda..db5dd70445 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -171,6 +171,11 @@ static WCHAR *get_item_string( const LB_DESCR *descr, UINT index ) return HAS_STRINGS(descr) ? descr->items[index].str : NULL; }
+static void set_item_string( const LB_DESCR *descr, UINT index, WCHAR *string ) +{ + if (!(descr->style & LBS_NODATA)) descr->items[index].str = string; +} + static UINT get_item_height( const LB_DESCR *descr, UINT index ) { return (descr->style & LBS_NODATA) ? 0 : descr->items[index].height; @@ -203,11 +208,6 @@ static void insert_item_data(LB_DESCR *descr, UINT index, WCHAR *str, ULONG_PTR item = descr->items + index; if (index < descr->nb_items) memmove(item + 1, item, (descr->nb_items - index) * sizeof(LB_ITEMDATA)); - - item->str = str; - item->data = HAS_STRINGS(descr) ? 0 : data; - item->height = 0; - item->selected = FALSE; }
static void remove_item_data(LB_DESCR *descr, UINT index) @@ -1601,6 +1601,10 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index,
insert_item_data(descr, index, str, data); descr->nb_items++; + set_item_string(descr, index, str); + set_item_data(descr, index, HAS_STRINGS(descr) ? 0 : data); + set_item_height(descr, index, 0); + set_item_selected_state(descr, index, FALSE);
/* Get item height */