From: Brian Date: Wed, 7 Nov 2007 15:57:56 +0000 (-0700) Subject: redo xm_surface_release() to match i915 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5d9021554ee78699933ddf79e5231cded6f9c641;p=mesa.git redo xm_surface_release() to match i915 --- diff --git a/src/mesa/pipe/xlib/xm_winsys.c b/src/mesa/pipe/xlib/xm_winsys.c index d737e984d1c..506923784c5 100644 --- a/src/mesa/pipe/xlib/xm_winsys.c +++ b/src/mesa/pipe/xlib/xm_winsys.c @@ -300,9 +300,12 @@ static void xm_surface_release(struct pipe_winsys *winsys, struct pipe_surface **s) { struct pipe_surface *surf = *s; - if (surf->region) - winsys->region_release(winsys, &surf->region); - free(surf); + surf->refcount--; + if (surf->refcount == 0) { + if (surf->region) + winsys->region_release(winsys, &surf->region); + free(surf); + } *s = NULL; }