[Mesa-dev] [PATCH] mesa: remove warning message in _mesa_reference_renderbuffer_()

Ian Romanick idr at freedesktop.org
Sat Dec 1 12:43:55 PST 2012


On 12/01/2012 09:56 AM, Brian Paul wrote:
> From: Brian Paul <brianp at vmware.com>
>
> We were warning when there was no current context and we're about
> to delete a renderbuffer, but that happens fairly often and isn't
> really a problem.
>
> Fixes http://bugs.freedesktop.org/show_bug.cgi?id=57754

I'm really confused.  A previous patch added the context pointer to 
gl_renderbuffer::Delete with the commit message

     We sometimes need a rendering context when deleting renderbuffers.
     Pass it explicitly instead of trying to grab a current context
     (which might be NULL).  The next patch will make use of this.

But we're allowing NULL to be passed in all the same cases where it 
could have been NULL before.  Right?  What is preventing 
st_renderbuffer_delete from dereferencing a NULL pointer (instead of 
accessing freed memory)?  Does it just leak memory now?

In any case, this makes the warnings go away on i965.

Tested-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>   src/mesa/main/renderbuffer.c |    5 +----
>   1 files changed, 1 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
> index 2f28443..b426162 100644
> --- a/src/mesa/main/renderbuffer.c
> +++ b/src/mesa/main/renderbuffer.c
> @@ -160,10 +160,7 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
>
>         if (deleteFlag) {
>            GET_CURRENT_CONTEXT(ctx);
> -         if (ctx)
> -            oldRb->Delete(ctx, oldRb);
> -         else
> -            _mesa_problem(NULL, "Unable to delete renderbuffer, no context");
> +         oldRb->Delete(ctx, oldRb);
>         }
>
>         *ptr = NULL;
>



More information about the mesa-dev mailing list