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>
This commit is contained in:
Piotr Caban 2017-03-21 13:03:55 +01:00 committed by Alexandre Julliard
parent 4c54f9aeac
commit a878f0a02a
2 changed files with 3 additions and 1 deletions

View File

@ -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);

View File

@ -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 );