wgl: Don't crash in stw_make_current if current framebuffer is NULL

Fixes #3878

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7999>
This commit is contained in:
Louis-Francis Ratté-Boulianne 2020-12-08 22:57:39 -05:00 committed by Marge Bot
parent 255ca7ecda
commit a2751080aa

View file

@ -446,11 +446,21 @@ stw_make_current(HDC hDrawDC, HDC hReadDC, DHGLRC dhglrc)
}
} else {
if (old_ctx->shared) {
stw_st_flush(old_ctx->st, old_ctx->current_framebuffer->stfb,
ST_FLUSH_FRONT | ST_FLUSH_WAIT);
if (old_ctx->current_framebuffer) {
stw_st_flush(old_ctx->st, old_ctx->current_framebuffer->stfb,
ST_FLUSH_FRONT | ST_FLUSH_WAIT);
} else {
struct pipe_fence_handle *fence = NULL;
old_ctx->st->flush(old_ctx->st,
ST_FLUSH_FRONT | ST_FLUSH_WAIT, &fence,
NULL, NULL);
}
} else {
stw_st_flush(old_ctx->st, old_ctx->current_framebuffer->stfb,
ST_FLUSH_FRONT);
if (old_ctx->current_framebuffer)
stw_st_flush(old_ctx->st, old_ctx->current_framebuffer->stfb,
ST_FLUSH_FRONT);
else
old_ctx->st->flush(old_ctx->st, ST_FLUSH_FRONT, NULL, NULL, NULL);
}
}
}