Module: wine Branch: master Commit: a878f0a02ad553b94b78b907715c691507dea501 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a878f0a02ad553b94b78b90771...
Author: Piotr Caban piotr@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@codeweavers.com Signed-off-by: Alexandre Julliard julliard@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 );