From c39268967d07f41b67a47fcea003a59a98a6dd41 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sat, 21 Nov 2009 11:59:33 +0300 Subject: [PATCH] comctl32/listview: Do nothing on LVM_CANCELEDITLABEL if there's no label. --- dlls/comctl32/listview.c | 11 +++++++---- dlls/comctl32/tests/listview.c | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index d59a984fa2..594db6e197 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -5081,11 +5081,14 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte */ static LRESULT LISTVIEW_CancelEditLabel(LISTVIEW_INFO *infoPtr) { - /* handle value will be lost after LISTVIEW_EndEditLabelT */ - HWND edit = infoPtr->hwndEdit; + if (infoPtr->hwndEdit) + { + /* handle value will be lost after LISTVIEW_EndEditLabelT */ + HWND edit = infoPtr->hwndEdit; - LISTVIEW_EndEditLabelT(infoPtr, TRUE, IsWindowUnicode(infoPtr->hwndEdit)); - SendMessageW(edit, WM_CLOSE, 0, 0); + LISTVIEW_EndEditLabelT(infoPtr, TRUE, IsWindowUnicode(infoPtr->hwndEdit)); + SendMessageW(edit, WM_CLOSE, 0, 0); + } return TRUE; } diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 44c5eb2c49..6b3ebffa8b 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -3720,8 +3720,11 @@ static void test_canceleditlabel(void) insert_item(hwnd, 0); /* try without edit created */ + flush_sequences(sequences, NUM_MSG_SEQUENCES); ret = SendMessage(hwnd, LVM_CANCELEDITLABEL, 0, 0); expect(TRUE, ret); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, + "cancel edit label without edit", FALSE); /* cancel without data change */ SetFocus(hwnd);