Piotr Caban : user32: Don't call IsChild with NULL window in EnableWindow.
Alexandre Julliard
julliard at winehq.org
Tue Mar 21 16:05:53 CDT 2017
Module: wine
Branch: master
Commit: a878f0a02ad553b94b78b907715c691507dea501
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a878f0a02ad553b94b78b907715c691507dea501
Author: Piotr Caban <piotr at codeweavers.com>
Date: Tue Mar 21 13:03:55 2017 +0100
user32: Don't call IsChild with NULL window in EnableWindow.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/win.c | 2 ++
dlls/user32/win.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 6e11ff2..915012c 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -3091,7 +3091,9 @@ static void test_SetFocus(HWND hwnd)
ShowWindow(child, SW_SHOW);
SetFocus(child);
ok( GetFocus() == child, "Focus should be on child %p\n", child );
+ SetLastError(0xdeadbeef);
EnableWindow(hwnd, FALSE);
+ ok(GetLastError() == 0xdeadbeef, "got error %u in EnableWindow call\n", GetLastError());
ok( GetFocus() == child, "Focus should still be on child %p\n", child );
EnableWindow(hwnd, TRUE);
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 4406577..f3b4ef5 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -2171,7 +2171,7 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
SetFocus( 0 ); /* A disabled window can't have the focus */
capture_wnd = GetCapture();
- if (hwnd == capture_wnd || IsChild(hwnd, capture_wnd))
+ if (capture_wnd && (hwnd == capture_wnd || IsChild(hwnd, capture_wnd)))
ReleaseCapture(); /* A disabled window can't capture the mouse */
SendMessageW( hwnd, WM_ENABLE, FALSE, 0 );
More information about the wine-cvs
mailing list