mesa: Don't crash when destroying contexts created with no visual.

dEQP-EGL.functional.create_context.no_config tries to create a context
with no config, then immediately destroys it.  The drawbuffer is never
set up, so we can't dereference it asking if it's double buffered, or
we'll crash on a null pointer dereference.

Just bail early.

Applications using EGL_KHR_no_config_context could hit this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
This commit is contained in:
Kenneth Graunke 2017-02-02 10:10:30 -08:00
parent af303abcdb
commit 3f064e9a40
1 changed files with 1 additions and 1 deletions

View File

@ -1550,7 +1550,7 @@ _mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height)
static void
handle_first_current(struct gl_context *ctx)
{
if (ctx->Version == 0) {
if (ctx->Version == 0 || !ctx->DrawBuffer) {
/* probably in the process of tearing down the context */
return;
}