From: Paul Gofman <pgofman@codeweavers.com> wgl_context_flush() may recreate the drawable and release the old one. --- dlls/opengl32/unix_wgl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 6d73b1cd735..1d0c995e7fe 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1376,6 +1376,7 @@ static void flush_context( TEB *teb, void (*flush)(void) ) { struct opengl_drawable *read, *draw; struct context *ctx = get_current_context( teb, &read, &draw ); + HWND draw_hwnd = ctx && draw && draw->client ? draw->client->hwnd : NULL; const struct opengl_funcs *funcs = teb->glTable; UINT flags = 0; @@ -1395,7 +1396,7 @@ static void flush_context( TEB *teb, void (*flush)(void) ) WARN( "Front buffer rendering emulation, copying front buffer back\n" ); - NtUserGetClientRect( draw->client->hwnd, &rect, NtUserGetDpiForWindow( draw->client->hwnd ) ); + NtUserGetClientRect( draw_hwnd, &rect, NtUserGetDpiForWindow( draw_hwnd ) ); if (ctx->read_fbo) funcs->p_glBindFramebuffer( GL_READ_FRAMEBUFFER, 0 ); funcs->p_glReadBuffer( GL_FRONT_LEFT ); funcs->p_glBlitFramebuffer( 0, 0, rect.right, rect.bottom, 0, 0, rect.right, rect.bottom, mask, GL_NEAREST ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10190