[PATCH 1/7] Do nothing on LVM_CANCELEDITLABEL if there's no label

Nikolay Sivov bunglehead at gmail.com
Sat Nov 21 02:59:33 CST 2009


---
 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 d59a984..594db6e 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 44c5eb2..6b3ebff 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);
-- 
1.5.6.5


--=-6Hv8fg563ZrKBcHl/LUU--




More information about the wine-patches mailing list