[Mesa-dev] [PATCH] mesa: Avoid leaking surface in st_renderbuffer_delete

Rob Clark robdclark at gmail.com
Thu Apr 27 13:51:58 UTC 2017


On Thu, Apr 27, 2017 at 9:18 AM, Bartosz Tomczyk
<bartosz.tomczyk86 at gmail.com> wrote:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100741
> Fixes: a5e733c6b52 mesa: drop current draw/read buffer when ctx is released
> CC: Rob Clark <robdclark at gmail.com>

That looks reasonable to me..  wouldn't hurt to put a sentence or two
about it in the patch description so someone looking at the history
doesn't have to go back to bugzilla to see the reasoning.

Reviewed-by: Rob Clark <robdclark at gmail.com>

> ---
>  src/mesa/main/context.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 3570f94f5a..b0a46422f2 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -1664,8 +1664,6 @@ _mesa_make_current( struct gl_context *newCtx,
>        _mesa_flush(curCtx);
>
>     /* We used to call _glapi_check_multithread() here.  Now do it in drivers */
> -   _glapi_set_context((void *) newCtx);
> -   assert(_mesa_get_current_context() == newCtx);
>
>     if (!newCtx) {
>        _glapi_set_dispatch(NULL);  /* none current */
> @@ -1673,8 +1671,12 @@ _mesa_make_current( struct gl_context *newCtx,
>           _mesa_reference_framebuffer(&curCtx->WinSysDrawBuffer, NULL);
>           _mesa_reference_framebuffer(&curCtx->WinSysReadBuffer, NULL);
>        }
> +      _glapi_set_context(NULL);
> +      assert(_mesa_get_current_context() == NULL);
>     }
>     else {
> +      _glapi_set_context((void *) newCtx);
> +      assert(_mesa_get_current_context() == newCtx);
>        _glapi_set_dispatch(newCtx->CurrentClientDispatch);
>
>        if (drawBuffer && readBuffer) {
> --
> 2.12.2
>


More information about the mesa-dev mailing list