From 3769b1d38f00cc95cf0e4e1f2a01ba178b6da408 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Wed, 11 Mar 2020 09:31:33 +0800 Subject: [PATCH] do not call any GDI functions in mg_TerminateScreenDC --- src/newgdi/gdi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/newgdi/gdi.c b/src/newgdi/gdi.c index 074a2b5a..baa8c67b 100644 --- a/src/newgdi/gdi.c +++ b/src/newgdi/gdi.c @@ -291,6 +291,8 @@ BOOL mg_InitScreenDC (void) void mg_TerminateScreenDC (void) { +#if 0 /* deprecated code */ + /* Since 5.0.0, do not call any GDI functions here */ RECT rcScr = GetScreenRect (); SelectClipRect (HDC_SCREEN, &rcScr); @@ -300,11 +302,16 @@ void mg_TerminateScreenDC (void) #endif FillBox (HDC_SCREEN, rcScr.left, rcScr.top, rcScr.right, rcScr.bottom); + SelectClipRect (HDC_SCREEN_SYS, &rcScr); +#endif /* deprecated code */ + EmptyClipRgn (&__mg_screen_dc.lcrgn); + EmptyClipRgn (&__mg_screen_dc.ecrgn); if (__mg_screen_dc.alpha_pixel_format) free (__mg_screen_dc.alpha_pixel_format); - SelectClipRect (HDC_SCREEN_SYS, &rcScr); + EmptyClipRgn (&__mg_screen_sys_dc.lcrgn); + EmptyClipRgn (&__mg_screen_sys_dc.ecrgn); if (__mg_screen_sys_dc.alpha_pixel_format) free (__mg_screen_sys_dc.alpha_pixel_format); @@ -312,6 +319,7 @@ void mg_TerminateScreenDC (void) DESTROY_LOCK (&__mg_gdilock); DESTROY_LOCK (&dcslot); + /* [2010/06/02] DongJunJie : fix a dead-lock bug of mgncs. */ DestroyFreeClipRectList (&__mg_FreeClipRectList); }