summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2009-03-04 22:54:33 +0100
committerJakob Bornecrantz <[email protected]>2009-03-05 00:10:12 +0100
commitdca226fefb9a0e469ca34b3c1e364b60fae341fa (patch)
tree1b90003d0ac9efcfb921651d6663236cef3880f0 /src/gallium/state_trackers
parent5aa356d3e454c78332cd9faa01cd6dc24579e46c (diff)
st/xorg: Fix transfer double free
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index e53b46c3ad2..a69df3f7f17 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -55,6 +55,7 @@ struct PixmapPriv
unsigned int color;
struct pipe_surface *src_surf; /* for copies */
struct pipe_transfer *map_transfer;
+ unsigned map_count;
};
/*
@@ -116,6 +117,8 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
if (!priv->tex)
return FALSE;
+
+ if (priv->map_count++ == 0)
{
priv->map_transfer =
exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
@@ -146,9 +149,12 @@ ExaFinishAccess(PixmapPtr pPix, int index)
if (!priv->map_transfer)
return;
- exa->scrn->transfer_unmap(exa->scrn, priv->map_transfer);
- exa->scrn->tex_transfer_destroy(priv->map_transfer);
-
+ if (--priv->map_count == 0) {
+ assert(priv->map_transfer);
+ exa->scrn->transfer_unmap(exa->scrn, priv->map_transfer);
+ exa->scrn->tex_transfer_destroy(priv->map_transfer);
+ priv->map_transfer = NULL;
+ }
}
static void
@@ -258,7 +264,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
PIPE_BUFFER_USAGE_GPU_READ |
PIPE_BUFFER_USAGE_GPU_WRITE);
- return FALSE;
+ return TRUE;
}
static void