From d4d65e2df9c465f02a06ca91c847dd575c0df6ea Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Fri, 29 Jul 2016 15:09:33 +0100 Subject: [PATCH] gdi32: Move the release until after the final dc access. Also only reselect the font if the graphics mode changes. Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/gdi32/dc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 59a3d9b33f3..3b6c2eaccf3 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -1037,9 +1037,9 @@ INT WINAPI SetGraphicsMode( HDC hdc, INT mode ) ret = dc->GraphicsMode; dc->GraphicsMode = mode; } - release_dc_ptr( dc ); /* font metrics depend on the graphics mode */ - if (ret) SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT)); + if (ret != mode) SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT)); + release_dc_ptr( dc ); return ret; }