From 509577999916c0e9baa638176d7b12954e46b6b4 Mon Sep 17 00:00:00 2001 From: Marco Bizzarri <m.bizzarri@icube.it> Date: Fri, 3 Aug 2001 18:17:14 +0000 Subject: [PATCH] GetControlBrush16: avoid potentially releasing the same pointer twice. --- windows/painting.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/windows/painting.c b/windows/painting.c index d7b514f6d50..20f17a15917 100644 --- a/windows/painting.c +++ b/windows/painting.c @@ -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; } -- GitLab