Fabian Bieler : user32: Do not call NULL message callback.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 26 07:59:27 CST 2007


Module: wine
Branch: master
Commit: 311423242b8981db8712624bb1d9fa5fccaff055
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=311423242b8981db8712624bb1d9fa5fccaff055

Author: Fabian Bieler <der.fabe at gmx.net>
Date:   Sat Feb 24 19:57:22 2007 +0100

user32: Do not call NULL message callback.

---

 dlls/user32/message.c   |    2 ++
 dlls/user32/tests/msg.c |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 22b922d..5d7020e 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -1905,6 +1905,8 @@ static BOOL process_hardware_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info
 static inline void call_sendmsg_callback( SENDASYNCPROC callback, HWND hwnd, UINT msg,
                                           ULONG_PTR data, LRESULT result )
 {
+    if (!callback) return;
+
     if (TRACE_ON(relay))
         DPRINTF( "%04x:Call message callback %p (hwnd=%p,msg=%s,data=%08lx,result=%08lx)\n",
                  GetCurrentThreadId(), callback, hwnd, SPY_GetMsgName( msg, hwnd ),
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index f45a059..7b4505d 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -8889,6 +8889,20 @@ static void test_dialog_messages(void)
 #undef check_selection
 }
 
+static void test_nullCallback(void)
+{
+    HWND hwnd;
+    MSG msg;
+
+    hwnd = CreateWindowExA(0, "TestWindowClass", "Test overlapped", WS_OVERLAPPEDWINDOW,
+                           100, 100, 200, 200, 0, 0, 0, NULL);
+    ok (hwnd != 0, "Failed to create overlapped window\n");
+
+    SendMessageCallbackA(hwnd,WM_NULL,0,0,NULL,0);
+    while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+    DestroyWindow(hwnd);
+}
+
 START_TEST(msg)
 {
     BOOL ret;
@@ -8959,6 +8973,7 @@ START_TEST(msg)
     test_SetWindowRgn();
     test_sys_menu();
     test_dialog_messages();
+    test_nullCallback();
 
     UnhookWindowsHookEx(hCBT_hook);
     if (pUnhookWinEvent)




More information about the wine-cvs mailing list