[PATCH v2 08/11] gdi32: Move the release until after the final dc access.

Huw Davies huw at codeweavers.com
Fri Jul 29 09:09:33 CDT 2016


Also only reselect the font if the graphics mode changes.

Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 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 59a3d9b..3b6c2ea 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;
 }
 
-- 
2.7.4




More information about the wine-patches mailing list