From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/unix_wgl.c | 6 +++--- dlls/opengl32/wgl.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index fbf5654aeaa..fcaa5345c2d 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1363,7 +1363,7 @@ HGLRC wrap_wglCreateContextAttribsARB( TEB *teb, HDC hdc, HGLRC client_shared, c BOOL wrap_wglMakeContextCurrentARB( TEB *teb, HDC draw_hdc, HDC read_hdc, HGLRC client_context ) { - struct context *ctx, *prev = get_current_context( teb, NULL, NULL ); + struct context *ctx; if (client_context) { @@ -1372,12 +1372,12 @@ BOOL wrap_wglMakeContextCurrentARB( TEB *teb, HDC draw_hdc, HDC read_hdc, HGLRC if (!funcs->p_wglMakeContextCurrentARB( draw_hdc, read_hdc, client_context )) return FALSE; make_context_current( teb, funcs, draw_hdc, read_hdc, client_context, ctx ); } - else if (prev) + else { const struct opengl_funcs *funcs = teb->glTable; if (!funcs->p_wglMakeContextCurrentARB( NULL, NULL, NULL )) return FALSE; - teb->glTable = &null_opengl_funcs; } + return TRUE; } diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index aac6d7965e4..667d555069e 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -913,6 +913,8 @@ BOOL WINAPI wglDeleteContext( HGLRC handle ) if ((status = UNIX_CALL( wglDeleteContext, &args ))) WARN( "wglDeleteContext returned %#lx\n", status ); if (status || !args.ret) return FALSE; + /* make sure there's a (dummy) context before releasing and destroying display list objects */ + if (!teb->glCurrentRC) wglMakeCurrent( NULL, NULL ); free_client_context( ptr ); return TRUE; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11161