comctl32/listbox: Shrink the item array with resize_storage.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3afbda2ae2
commit
ff87384048
|
@ -1669,7 +1669,6 @@ static void LISTBOX_DeleteItem( LB_DESCR *descr, INT index )
|
|||
static LRESULT LISTBOX_RemoveItem( LB_DESCR *descr, INT index )
|
||||
{
|
||||
LB_ITEMDATA *item;
|
||||
INT max_items;
|
||||
|
||||
if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
|
||||
|
||||
|
@ -1689,20 +1688,8 @@ static LRESULT LISTBOX_RemoveItem( LB_DESCR *descr, INT index )
|
|||
(descr->nb_items - index) * sizeof(LB_ITEMDATA) );
|
||||
if (descr->anchor_item == descr->nb_items) descr->anchor_item--;
|
||||
|
||||
/* Shrink the item array if possible */
|
||||
resize_storage(descr, descr->nb_items);
|
||||
|
||||
max_items = descr->items_size;
|
||||
if (descr->nb_items < max_items - 2*LB_ARRAY_GRANULARITY)
|
||||
{
|
||||
max_items -= LB_ARRAY_GRANULARITY;
|
||||
item = HeapReAlloc( GetProcessHeap(), 0, descr->items,
|
||||
max_items * sizeof(LB_ITEMDATA) );
|
||||
if (item)
|
||||
{
|
||||
descr->items_size = max_items;
|
||||
descr->items = item;
|
||||
}
|
||||
}
|
||||
/* Repaint the items */
|
||||
|
||||
LISTBOX_UpdateScroll( descr );
|
||||
|
|
Loading…
Reference in New Issue