comctl32/listview - Issue LVM_DELETEALLITEMS from WM_DESTROY
Jason Edmeades
jason.edmeades at googlemail.com
Wed Jan 13 17:10:14 CST 2010
Test included, also run through the staggeringly fantastic winetestbot
across all the VM's with success (Job 300) - I can but thank Ge for
setting that up!
Basically wine has a message ordering issue in the listview
notification, resulting in a trap for an application I was debugging,
in that it sent the notification from WM_NCDESTROY whereas windows
sends it in the WM_DESTROY processing.
Jason
-------------- next part --------------
From 984209afc5b22e1a5103991fe4fd9f5f9ec0868e Mon Sep 17 00:00:00 2001
From: Jason Edmeades <jason.edmeades at googlemail.com>
Date: Wed, 13 Jan 2010 14:51:01 -0800
Subject: [PATCH] comctl32/listview - Send LVN_DELETEALLITEMS in WM_DESTROY not WM_NCDESTROY
As per the test, windows sends the delete all items message in WM_DESTROY
processing, and wine was sending it in the WM_NCDESTROY processing, which
caused an application to trap.
---
dlls/comctl32/listview.c | 9 +++++----
dlls/comctl32/tests/listview.c | 30 +++++++++++++++++++++++++++++-
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index d21935f..80a32f7 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -9188,10 +9188,14 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
* Success: 0
* Failure: -1
*/
-static LRESULT LISTVIEW_Destroy(const LISTVIEW_INFO *infoPtr)
+static LRESULT LISTVIEW_Destroy(LISTVIEW_INFO *infoPtr)
{
HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
CloseThemeData(theme);
+
+ /* delete all items */
+ LISTVIEW_DeleteAllItems(infoPtr, TRUE);
+
return 0;
}
@@ -9923,9 +9927,6 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
TRACE("()\n");
- /* delete all items */
- LISTVIEW_DeleteAllItems(infoPtr, TRUE);
-
/* destroy data structure */
DPA_Destroy(infoPtr->hdpaItems);
DPA_Destroy(infoPtr->hdpaItemIds);
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 0122886..0bac4ec 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -32,7 +32,8 @@
#define PARENT_FULL_SEQ_INDEX 1
#define LISTVIEW_SEQ_INDEX 2
#define EDITBOX_SEQ_INDEX 3
-#define NUM_MSG_SEQUENCES 4
+#define COMBINED_SEQ_INDEX 4
+#define NUM_MSG_SEQUENCES 5
#define LISTVIEW_ID 0
#define HEADER_ID 1
@@ -286,6 +287,18 @@ static const struct message hover_parent[] = {
{ 0 }
};
+static const struct message listview_destroy[] = {
+ { 0x0090, sent|optional }, /* Vista */
+ { WM_PARENTNOTIFY, sent },
+ { WM_SHOWWINDOW, sent },
+ { WM_WINDOWPOSCHANGING, sent },
+ { WM_WINDOWPOSCHANGED, sent|optional },
+ { WM_DESTROY, sent },
+ { WM_NOTIFY, sent|id, 0, 0, LVN_DELETEALLITEMS },
+ { WM_NCDESTROY, sent },
+ { 0 }
+};
+
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static LONG defwndproc_counter = 0;
@@ -312,6 +325,7 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
add_message(sequences, PARENT_SEQ_INDEX, &msg);
+ add_message(sequences, COMBINED_SEQ_INDEX, &msg);
}
add_message(sequences, PARENT_FULL_SEQ_INDEX, &msg);
@@ -460,6 +474,7 @@ static LRESULT WINAPI listview_subclass_proc(HWND hwnd, UINT message, WPARAM wPa
msg.lParam = lParam;
msg.id = LISTVIEW_ID;
add_message(sequences, LISTVIEW_SEQ_INDEX, &msg);
+ add_message(sequences, COMBINED_SEQ_INDEX, &msg);
defwndproc_counter++;
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
@@ -4263,6 +4278,18 @@ static void test_hover(void)
DestroyWindow(hwnd);
}
+static void test_destroynotify(void)
+{
+ HWND hwnd;
+
+ hwnd = create_listview_control(LVS_REPORT);
+ ok(hwnd != NULL, "failed to create listview window\n");
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ DestroyWindow(hwnd);
+ ok_sequence(sequences, COMBINED_SEQ_INDEX, listview_destroy, "check destroy order", FALSE);
+}
+
START_TEST(listview)
{
HMODULE hComctl32;
@@ -4323,6 +4350,7 @@ START_TEST(listview)
test_approximate_viewrect();
test_finditem();
test_hover();
+ test_destroynotify();
if (!load_v6_module(&ctx_cookie, &hCtx))
{
--
1.6.0.4
More information about the wine-patches
mailing list