mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Fix DC leak
svn path=/trunk/; revision=6798
This commit is contained in:
parent
12903da5d6
commit
d1dcdd7a8d
1 changed files with 10 additions and 3 deletions
|
@ -790,6 +790,7 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
|
|||
BOOL InBtn, HasBtn = FALSE;
|
||||
ULONG Btn, Style;
|
||||
WPARAM SCMsg, CurBtn = wParam, OrigBtn = wParam;
|
||||
HDC WindowDC;
|
||||
|
||||
Style = GetWindowLongW(hWnd, GWL_STYLE);
|
||||
switch(wParam)
|
||||
|
@ -818,7 +819,10 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
|
|||
SetCapture(hWnd);
|
||||
|
||||
if(HasBtn)
|
||||
UserDrawCaptionButtonWnd( hWnd, GetWindowDC(hWnd), HasBtn , Btn);
|
||||
{
|
||||
WindowDC = GetWindowDC(hWnd);
|
||||
UserDrawCaptionButtonWnd(hWnd, WindowDC, HasBtn , Btn);
|
||||
}
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
@ -832,6 +836,8 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
|
|||
else
|
||||
{
|
||||
ReleaseCapture();
|
||||
if (HasBtn)
|
||||
ReleaseDC(hWnd, WindowDC);
|
||||
return;
|
||||
}
|
||||
case WM_NCMOUSEMOVE:
|
||||
|
@ -841,7 +847,7 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
|
|||
CurBtn = DefWndNCHitTest(hWnd, Msg.pt);
|
||||
if(InBtn != (CurBtn == OrigBtn))
|
||||
{
|
||||
UserDrawCaptionButtonWnd( hWnd, GetWindowDC(hWnd), (CurBtn == OrigBtn) , Btn);
|
||||
UserDrawCaptionButtonWnd( hWnd, WindowDC, (CurBtn == OrigBtn) , Btn);
|
||||
}
|
||||
InBtn = CurBtn == OrigBtn;
|
||||
}
|
||||
|
@ -850,7 +856,8 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
|
|||
}
|
||||
|
||||
done:
|
||||
UserDrawCaptionButtonWnd( hWnd, GetWindowDC(hWnd), FALSE , Btn);
|
||||
UserDrawCaptionButtonWnd( hWnd, WindowDC, FALSE , Btn);
|
||||
ReleaseDC(hWnd, WindowDC);
|
||||
ReleaseCapture();
|
||||
SendMessageA(hWnd, WM_SYSCOMMAND, SCMsg, 0);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue