[Mesa-dev] Mesa (master): i965: Don' t free the intel_context structure when intelCreateContext fails.

Ian Romanick idr at freedesktop.org
Fri Sep 28 15:34:10 PDT 2012


On 09/28/2012 03:05 PM, Ian Romanick wrote:
> Module: Mesa
> Branch: master
> Commit: 87f26214d6bdeb439b30615ec53c293c5141cf11
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=87f26214d6bdeb439b30615ec53c293c5141cf11
>
> Author: Ian Romanick <ian.d.romanick at intel.com>
> Date:   Fri Aug 31 14:55:21 2012 -0700
>
> i965: Don't free the intel_context structure when intelCreateContext fails.
>
> intelDestroyContext will eventually be called, and it will clean things
> up.  The call to brwInitVtbl is moved earlier so that
> intelDestroyContext can call the device-specific destructor.  This also
> makes the code look more like the i915 code.
>
> NOTE: This is a candidate for the 9.0 branch.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Reviewed-by: Eric Anholt <eric at anholt.net>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54301
>
> ---
>
>   src/mesa/drivers/dri/i965/brw_context.c |    5 ++---
>   1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> index 1083e28..418c873 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -140,6 +140,8 @@ brwCreateContext(int api,
>         return false;
>      }
>
> +   brwInitVtbl( brw );
> +

Yes, I know this part of the change broke the world.  I'm working on 
fixing it.

>      brwInitDriverFunctions(screen, &functions);
>
>      struct intel_context *intel = &brw->intel;
> @@ -148,13 +150,10 @@ brwCreateContext(int api,
>      if (!intelInitContext( intel, api, mesaVis, driContextPriv,
>   			  sharedContextPrivate, &functions )) {
>         printf("%s: failed to init intel context\n", __FUNCTION__);
> -      free(brw);
>         *error = __DRI_CTX_ERROR_NO_MEMORY;
>         return false;
>      }
>
> -   brwInitVtbl( brw );
> -
>      brw_init_surface_formats(brw);
>
>      /* Initialize swrast, tnl driver tables: */
>
> _______________________________________________
> mesa-commit mailing list
> mesa-commit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-commit



More information about the mesa-dev mailing list