[Mesa-dev] [PATCH] mesa: Don't crash when destroying contexts created with no visual.
Chad Versace
chadversary at chromium.org
Fri Feb 3 16:46:08 UTC 2017
On Fri 03 Feb 2017, Samuel Iglesias Gonsálvez wrote:
> Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
>
> On Thu, 2017-02-02 at 13:14 -0800, Kenneth Graunke wrote:
> > 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.
Reviewed-by: Chad Versace <chadversary at chromium.org>
Also, Mesa supports EGL_KHR_no_config_context. So this fix is probably
needed for realworld cases, not just for deqp.
> >
> > Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> > ---
> > src/mesa/main/context.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> > index 7ecd241e6eb..76763489b9f 100644
> > --- a/src/mesa/main/context.c
> > +++ b/src/mesa/main/context.c
> > @@ -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;
> > }
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list