From 4633fc5c03a2aff20d3b50a5b80dcaff8274dcc6 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sat, 23 Oct 2010 22:15:04 +0400 Subject: [PATCH] comctl32/treeview: Fix TVN_DELETEITEM to use item that is about to be deleted. --- dlls/comctl32/tests/treeview.c | 6 ++---- dlls/comctl32/treeview.c | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c index 7238bd0d46e..5088d91ac69 100644 --- a/dlls/comctl32/tests/treeview.c +++ b/dlls/comctl32/tests/treeview.c @@ -1359,10 +1359,8 @@ static void test_delete_items(void) if (item_sequence[0]->count == 2) { -todo_wine { - ok(msg[0].lParam == (LPARAM)hChild, "expected %p, got %lx\n", hChild, msg[0].lParam); - ok(msg[1].lParam == (LPARAM)hRoot, "expected %p, got %lx\n", hRoot, msg[1].lParam); -} + ok(msg[0].lParam == (LPARAM)hChild, "expected %p, got 0x%lx\n", hChild, msg[0].lParam); + ok(msg[1].lParam == (LPARAM)hRoot, "expected %p, got 0x%lx\n", hRoot, msg[1].lParam); } ret = SendMessageA(hTree, TVM_GETCOUNT, 0, 0); diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 1ca5639431a..f8c28de2f13 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -1479,12 +1479,12 @@ TREEVIEW_RemoveItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem) { TRACE("%p, (%s)\n", wineItem, TREEVIEW_ItemName(wineItem)); - TREEVIEW_SendTreeviewNotify(infoPtr, TVN_DELETEITEMW, TVC_UNKNOWN, - TVIF_HANDLE | TVIF_PARAM, wineItem, 0); - if (wineItem->firstChild) TREEVIEW_RemoveAllChildren(infoPtr, wineItem); + TREEVIEW_SendTreeviewNotify(infoPtr, TVN_DELETEITEMW, TVC_UNKNOWN, + TVIF_HANDLE | TVIF_PARAM, wineItem, 0); + TREEVIEW_UnlinkItem(wineItem); infoPtr->uNumItems--;