GetControlBrush16: avoid potentially releasing the same pointer

twice.
oldstable
Marco Bizzarri 2001-08-03 18:17:14 +00:00 committed by Alexandre Julliard
parent b91c3ca7d1
commit 5095779999
1 changed files with 5 additions and 15 deletions

View File

@ -479,23 +479,13 @@ void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
*/
HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
{
WND* wndPtr = WIN_FindWndPtr( hwnd );
HBRUSH16 retvalue;
if((ctlType <= CTLCOLOR_MAX) && wndPtr )
if (ctlType <= CTLCOLOR_MAX)
{
WND* parent;
if( wndPtr->dwStyle & WS_POPUP ) parent = WIN_LockWndPtr(wndPtr->owner);
else parent = WIN_LockWndPtr(wndPtr->parent);
if( !parent ) parent = wndPtr;
retvalue = (HBRUSH16)PAINT_GetControlBrush( parent->hwndSelf, hwnd, hdc, ctlType );
WIN_ReleaseWndPtr(parent);
goto END;
HWND16 parent = GetParent16( hwnd );
if (!parent) parent = hwnd;
return PAINT_GetControlBrush( parent, hwnd, hdc, ctlType );
}
retvalue = (HBRUSH16)0;
END:
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
return 0;
}