Commit 71a4ac73 authored by Joachim Priesner's avatar Joachim Priesner Committed by Alexandre Julliard

comctl32: Treeview: Set visible = TRUE when deleting first visible item.

This fixes a crash when deleting the first visible item if it has visibleOrder < 0 and thus the ISVISIBLE macro returns false (this happens when both insertion and deletion happened while bRedraw == false). Signed-off-by: 's avatarJoachim Priesner <joachim.priesner@web.de> Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 9ac1744b
......@@ -1910,6 +1910,9 @@ static void test_delete_items(void)
/* Regression test for a crash when deleting the first visible item while bRedraw == false. */
hTree = create_treeview_control(0);
ret = SendMessageA(hTree, WM_SETREDRAW, FALSE, 0);
ok(ret == 0, "got %d\n", ret);
ins.hParent = TVI_ROOT;
ins.hInsertAfter = TVI_ROOT;
U(ins).item.mask = TVIF_TEXT;
......@@ -1924,9 +1927,6 @@ static void test_delete_items(void)
hItem2 = TreeView_InsertItemA(hTree, &ins);
ok(hItem2 != NULL, "InsertItem failed\n");
ret = SendMessageA(hTree, WM_SETREDRAW, FALSE, 0);
ok(ret == 0, "got %d\n", ret);
ret = SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hItem1);
ok(ret == TRUE, "got %d\n", ret);
......
......@@ -1545,6 +1545,7 @@ TREEVIEW_DeleteItem(TREEVIEW_INFO *infoPtr, HTREEITEM item)
if (infoPtr->firstVisible == item)
{
visible = TRUE;
if (item->nextSibling)
newFirstVisible = item->nextSibling;
else if (item->prevSibling)
......
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