summaryrefslogtreecommitdiff
path: root/xserver/Xext/shm.c
diff options
context:
space:
mode:
Diffstat (limited to 'xserver/Xext/shm.c')
-rw-r--r--xserver/Xext/shm.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/xserver/Xext/shm.c b/xserver/Xext/shm.c
index 4dad8b6c6..b78791836 100644
--- a/xserver/Xext/shm.c
+++ b/xserver/Xext/shm.c
@@ -248,21 +248,20 @@ ShmDestroyPixmap(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
+ void *shmdesc = NULL;
Bool ret;
- if (pPixmap->refcnt == 1) {
- ShmDescPtr shmdesc;
-
- shmdesc = (ShmDescPtr) dixLookupPrivate(&pPixmap->devPrivates,
- shmPixmapPrivateKey);
- if (shmdesc)
- ShmDetachSegment((void *) shmdesc, pPixmap->drawable.id);
- }
+ if (pPixmap->refcnt == 1)
+ shmdesc = dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey);
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
ret = (*pScreen->DestroyPixmap) (pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
+
+ if (shmdesc)
+ ShmDetachSegment(shmdesc, pPixmap->drawable.id);
+
return ret;
}