[Mesa-dev] [PATCH 2/2] xlib: add null ctx check in glXDestroyContext()

Jose Fonseca jfonseca at vmware.com
Fri May 24 07:57:51 PDT 2013



----- Original Message -----
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64934
> NOTE: This is a candidate for the stable branches.
> ---
>  src/mesa/drivers/x11/fakeglx.c |   22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
> index c7fb327..031c305 100644
> --- a/src/mesa/drivers/x11/fakeglx.c
> +++ b/src/mesa/drivers/x11/fakeglx.c
> @@ -1533,16 +1533,18 @@ void _kw_ungrab_all( Display *dpy )
>  static void
>  Fake_glXDestroyContext( Display *dpy, GLXContext ctx )
>  {
> -   struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
> -   (void) dpy;
> -   MakeCurrent_PrevContext = 0;
> -   MakeCurrent_PrevDrawable = 0;
> -   MakeCurrent_PrevReadable = 0;
> -   MakeCurrent_PrevDrawBuffer = 0;
> -   MakeCurrent_PrevReadBuffer = 0;
> -   XMesaDestroyContext( glxCtx->xmesaContext );
> -   XMesaGarbageCollect(dpy);
> -   free(glxCtx);
> +   if (ctx) {
> +      struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
> +      (void) dpy;
> +      MakeCurrent_PrevContext = 0;
> +      MakeCurrent_PrevDrawable = 0;
> +      MakeCurrent_PrevReadable = 0;
> +      MakeCurrent_PrevDrawBuffer = 0;
> +      MakeCurrent_PrevReadBuffer = 0;
> +      XMesaDestroyContext( glxCtx->xmesaContext );
> +      XMesaGarbageCollect(dpy);
> +      free(glxCtx);
> +   }
>  }
>  
>  
> --
> 1.7.10.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


Reviewed-by: Jose Fonseca <jfonseca at vmware.com>


More information about the mesa-dev mailing list