redo xm_surface_release() to match i915
authorBrian <brian.paul@tungstengraphics.com>
Wed, 7 Nov 2007 15:57:56 +0000 (08:57 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Wed, 7 Nov 2007 15:57:56 +0000 (08:57 -0700)
src/mesa/pipe/xlib/xm_winsys.c

index d737e984d1c02f6a46b85376945d55b6d6c68b19..506923784c5c17830be81ff5d860e352157aed97 100644 (file)
@@ -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;
 }