summaryrefslogtreecommitdiff
path: root/dix/pixmap.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-08-03 16:41:45 +1000
committerDave Airlie <airlied@redhat.com>2012-08-07 08:25:06 +1000
commit1a465fef9bc21142eecca3999f0761a3c0501a09 (patch)
tree3aabe2134e1b23a24ee993b3d7cd30962600b98a /dix/pixmap.c
parentafa53fe7cffd430cf11f25ca818cb955a78c0c1c (diff)
pixmap: have slave pixmap take a reference on master pixmap
Since the free routines free the master pixmap then the slave, we should be taking a reference when we bind them together. Fixes a use-after-free when resizing a primed gears. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'dix/pixmap.c')
-rw-r--r--dix/pixmap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/dix/pixmap.c b/dix/pixmap.c
index 9163e99eb..241881262 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -148,6 +148,10 @@ PixmapPtr PixmapShareToSlave(PixmapPtr pixmap, ScreenPtr slave)
pixmap->drawable.height, depth, 0,
pixmap->devKind, NULL);
+ /* have the slave pixmap take a reference on the master pixmap
+ later we destroy them both at the same time */
+ pixmap->refcnt++;
+
spix->master_pixmap = pixmap;
ret = slave->SetSharedPixmapBacking(spix, handle);