From: Paul Gofman <pgofman@codeweavers.com> --- dlls/opengl32/unix_wgl.c | 3 +++ dlls/win32u/opengl.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 6d73b1cd735..09f51584dce 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1388,6 +1388,9 @@ static void flush_context( TEB *teb, void (*flush)(void) ) if (flush) flush(); } + /* Drawables might have been replaced in wgl_context_flush(). */ + ctx = get_current_context( teb, &read, &draw ); + if (flags & GL_FLUSH_FORCE_SWAP) { GLenum mask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index 486c3f45c2a..a3884ad41fb 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -1843,10 +1843,10 @@ static BOOL context_sync_drawables( struct opengl_context *context, HDC draw_hdc { NtCurrentTeb()->glContext = context; - if (old_draw && old_draw != new_draw && old_draw != new_read && old_draw->client) - set_window_opengl_drawable( old_draw->client->hwnd, old_draw, FALSE ); - if (old_read && old_read != new_draw && old_read != new_read && old_read->client) - set_window_opengl_drawable( old_read->client->hwnd, old_read, FALSE ); + if (old_draw && old_draw != new_draw && old_draw != new_read && old_draw->client && new_draw && new_draw->client) + set_window_opengl_drawable( old_draw->client->hwnd, new_draw, FALSE ); + if (old_read && old_read != new_draw && old_read != new_read && old_read->client && new_read && new_read->client) + set_window_opengl_drawable( old_read->client->hwnd, new_read, FALSE ); /* all good, release previous context drawables if any */ if (old_draw) opengl_drawable_release( old_draw ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10190