Fixed window lock problem in SetMenu().

This commit is contained in:
Andreas Mohr 2000-09-19 02:38:11 +00:00 committed by Alexandre Julliard
parent ab86a9e563
commit 6f07e8abbc

View File

@ -4065,16 +4065,16 @@ BOOL16 WINAPI SetMenu16( HWND16 hWnd, HMENU16 hMenu )
BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu ) BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu )
{ {
WND * wndPtr = WIN_FindWndPtr(hWnd); WND * wndPtr = WIN_FindWndPtr(hWnd);
BOOL res = FALSE;
TRACE("(%04x, %04x);\n", hWnd, hMenu); TRACE("(%04x, %04x);\n", hWnd, hMenu);
if (hMenu && !IsMenu(hMenu)) if (hMenu && !IsMenu(hMenu))
{ {
WARN("hMenu is not a menu handle\n"); WARN("hMenu is not a menu handle\n");
return FALSE; goto exit;
} }
if (wndPtr && !(wndPtr->dwStyle & WS_CHILD)) if (wndPtr && !(wndPtr->dwStyle & WS_CHILD))
{ {
if (GetCapture() == hWnd) ReleaseCapture(); if (GetCapture() == hWnd) ReleaseCapture();
@ -4085,10 +4085,8 @@ BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu )
LPPOPUPMENU lpmenu; LPPOPUPMENU lpmenu;
if (!(lpmenu = MENU_GetMenu(hMenu))) if (!(lpmenu = MENU_GetMenu(hMenu)))
{ goto exit;
WIN_ReleaseWndPtr(wndPtr);
return FALSE;
}
lpmenu->hWnd = hWnd; lpmenu->hWnd = hWnd;
lpmenu->wFlags &= ~MF_POPUP; /* Can't be a popup */ lpmenu->wFlags &= ~MF_POPUP; /* Can't be a popup */
lpmenu->Height = 0; /* Make sure we recalculate the size */ lpmenu->Height = 0; /* Make sure we recalculate the size */
@ -4096,11 +4094,11 @@ BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu )
if (IsWindowVisible(hWnd)) if (IsWindowVisible(hWnd))
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ); SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
WIN_ReleaseWndPtr(wndPtr); res = TRUE;
return TRUE;
} }
exit:
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
return FALSE; return res;
} }