Commit d24095a7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32: Fix LVN_DELETEALLITEMS notification for LVS_OWNERDATA case.

parent a3cd93ca
......@@ -5383,9 +5383,8 @@ static HIMAGELIST LISTVIEW_CreateDragImage(LISTVIEW_INFO *infoPtr, INT iItem, LP
*/
static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy)
{
NMLISTVIEW nmlv;
HDPA hdpaSubItems = NULL;
BOOL bSuppress;
BOOL suppress = FALSE;
ITEMHDR *hdrItem;
ITEM_INFO *lpItem;
ITEM_ID *lpID;
......@@ -5400,11 +5399,15 @@ static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy)
SetRectEmpty(&infoPtr->rcFocus);
/* But we are supposed to leave nHotItem as is! */
/* send LVN_DELETEALLITEMS notification */
ZeroMemory(&nmlv, sizeof(NMLISTVIEW));
nmlv.iItem = -1;
bSuppress = notify_listview(infoPtr, LVN_DELETEALLITEMS, &nmlv);
if (!(infoPtr->dwStyle & LVS_OWNERDATA) || !destroy)
{
NMLISTVIEW nmlv;
memset(&nmlv, 0, sizeof(NMLISTVIEW));
nmlv.iItem = -1;
suppress = notify_listview(infoPtr, LVN_DELETEALLITEMS, &nmlv);
}
for (i = infoPtr->nItemCount - 1; i >= 0; i--)
{
......@@ -5412,7 +5415,7 @@ static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy)
{
/* send LVN_DELETEITEM notification, if not suppressed
and if it is not a virtual listview */
if (!bSuppress) notify_deleteitem(infoPtr, i);
if (!suppress) notify_deleteitem(infoPtr, i);
hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i);
lpItem = DPA_GetPtr(hdpaSubItems, 0);
/* free id struct */
......
......@@ -330,6 +330,23 @@ static const struct message listview_destroy[] = {
{ 0 }
};
static const struct message listview_ownerdata_destroy[] = {
{ 0x0090, sent|optional }, /* Vista */
{ WM_PARENTNOTIFY, sent },
{ WM_SHOWWINDOW, sent },
{ WM_WINDOWPOSCHANGING, sent },
{ WM_WINDOWPOSCHANGED, sent|optional },
{ WM_DESTROY, sent },
{ WM_NCDESTROY, sent },
{ 0 }
};
static const struct message listview_ownerdata_deleteall[] = {
{ LVM_DELETEALLITEMS, sent },
{ WM_NOTIFY, sent|id, 0, 0, LVN_DELETEALLITEMS },
{ 0 }
};
static const struct message listview_header_changed_seq[] = {
{ LVM_SETCOLUMNA, sent },
{ WM_NOTIFY, sent|id|defwinproc, 0, 0, LISTVIEW_ID },
......@@ -5059,6 +5076,7 @@ static void test_hover(void)
static void test_destroynotify(void)
{
HWND hwnd;
BOOL ret;
hwnd = create_listview_control(LVS_REPORT);
ok(hwnd != NULL, "failed to create listview window\n");
......@@ -5066,6 +5084,23 @@ static void test_destroynotify(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
DestroyWindow(hwnd);
ok_sequence(sequences, COMBINED_SEQ_INDEX, listview_destroy, "check destroy order", FALSE);
/* same for ownerdata list */
hwnd = create_listview_control(LVS_REPORT|LVS_OWNERDATA);
ok(hwnd != NULL, "failed to create listview window\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
DestroyWindow(hwnd);
ok_sequence(sequences, COMBINED_SEQ_INDEX, listview_ownerdata_destroy, "check destroy order, ownerdata", FALSE);
hwnd = create_listview_control(LVS_REPORT|LVS_OWNERDATA);
ok(hwnd != NULL, "failed to create listview window\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
ret = SendMessageA(hwnd, LVM_DELETEALLITEMS, 0, 0);
ok(ret == TRUE, "got %d\n", ret);
ok_sequence(sequences, COMBINED_SEQ_INDEX, listview_ownerdata_deleteall, "deleteall ownerdata", FALSE);
DestroyWindow(hwnd);
}
static void test_header_notification(void)
......
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