[PATCH] winex11.drv: Fix crash when ctx is NULL in glxdrv_wglSwapBuffers().

Yutao Meng mengyutao at uniontech.com
Tue Mar 8 02:57:04 CST 2022


The variable ctx can be NULL, and it is checked before every sync_context() function call. However, it is not checked in the ExtEscape() function call in which it is trying to get the hdc member variable of ctx.

Signed-off-by: Yutao Meng <mengyutao at uniontech.com>
---
 dlls/winex11.drv/opengl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 567205f742c..6b179bc5c0d 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -3372,7 +3372,7 @@ static BOOL WINAPI glxdrv_wglSwapBuffers( HDC hdc )
 
     release_gl_drawable( gl );
 
-    if (escape.gl_drawable) ExtEscape( ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
+    if (ctx && escape.gl_drawable) ExtEscape( ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
     return TRUE;
 }
 
-- 
2.20.1







More information about the wine-devel mailing list