[PATCH] user32/scroll: Move GetDCEx to stop DC leak

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue May 17 02:53:57 CDT 2016


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/user32/scroll.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index a210962..6ac6a1d 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -882,7 +882,6 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt)
         return;
     }
 
-    hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
     vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
                                         &arrowSize, &thumbSize, &thumbPos );
     hwndOwner = (nBar == SB_CTL) ? GetParent(hwnd) : hwnd;
@@ -920,9 +919,12 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt)
           break;
 
       default:
+          WARN("unsupported msg %s\n", SPY_GetMsgName(msg,hwnd));
           return;  /* Should never happen */
     }
 
+    hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
+
     TRACE("Event: hwnd=%p bar=%d msg=%s pt=%d,%d hit=%d\n",
           hwnd, nBar, SPY_GetMsgName(msg,hwnd), pt.x, pt.y, hittest );
 
-- 
1.9.1




More information about the wine-patches mailing list