Signed-off-by: Nikolay Sivov nsivov@codeweavers.com ---
Fixes https://bugs.winehq.org/show_bug.cgi?id=43915
There's more problems with LVS_OWNERDATA lists, tests already cover some, callback mask for example is not relevant for this bug.
dlls/comctl32/listview.c | 1 + dlls/comctl32/tests/listview.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 4cb1f0d53a..4d700b9cec 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -8834,6 +8834,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl if (infoPtr->nFocusedItem >= nItems) { LISTVIEW_SetItemFocus(infoPtr, -1); + infoPtr->nFocusedItem = -1; SetRectEmpty(&infoPtr->rcFocus); } } diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 4e2efe422b..f291698e76 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -6107,10 +6107,9 @@ todo_wine ok(ret, "Failed to set item count.\n");
ret = SendMessageA(hwnd, LVM_GETNEXTITEM, -1, LVNI_FOCUSED); -todo_wine ok(ret == -1, "Unexpected focused item, ret %d\n", ret);
- ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent seq, owner data/focus 2", TRUE); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent seq, owner data/focus 2", FALSE);
/* 2 items, focus on index 0, reduce to 1 item. */ flush_sequences(sequences, NUM_MSG_SEQUENCES);