(!1711) dix: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping jungle, so use the proper dix function instead. See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754 Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									55d8ddcbcc
								
							
						
					
					
						commit
						b5f867506d
					
				| 
						 | 
				
			
			@ -1526,7 +1526,7 @@ ProcCreatePixmap(ClientPtr client)
 | 
			
		|||
        rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP,
 | 
			
		||||
                      pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
 | 
			
		||||
        if (rc != Success) {
 | 
			
		||||
            (*pDraw->pScreen->DestroyPixmap) (pMap);
 | 
			
		||||
            dixDestroyPixmap(pMap, 0);
 | 
			
		||||
            return rc;
 | 
			
		||||
        }
 | 
			
		||||
        if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								dix/gc.c
								
								
								
								
							
							
						
						
									
										20
									
								
								dix/gc.c
								
								
								
								
							| 
						 | 
				
			
			@ -255,7 +255,7 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion)
 | 
			
		|||
            else {
 | 
			
		||||
                pPixmap->refcnt++;
 | 
			
		||||
                if (!pGC->tileIsPixel)
 | 
			
		||||
                    (*pGC->pScreen->DestroyPixmap) (pGC->tile.pixmap);
 | 
			
		||||
                    dixDestroyPixmap(pGC->tile.pixmap, 0);
 | 
			
		||||
                pGC->tileIsPixel = FALSE;
 | 
			
		||||
                pGC->tile.pixmap = pPixmap;
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -272,7 +272,7 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion)
 | 
			
		|||
                if (pPixmap)
 | 
			
		||||
                    pPixmap->refcnt++;
 | 
			
		||||
                if (pGC->stipple)
 | 
			
		||||
                    (*pGC->pScreen->DestroyPixmap) (pGC->stipple);
 | 
			
		||||
                    dixDestroyPixmap(pGC->stipple, 0);
 | 
			
		||||
                pGC->stipple = pPixmap;
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
| 
						 | 
				
			
			@ -589,8 +589,7 @@ CreateDefaultTile(GCPtr pGC)
 | 
			
		|||
        (*pGC->pScreen->CreatePixmap) (pGC->pScreen, w, h, pGC->depth, 0);
 | 
			
		||||
    pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen);
 | 
			
		||||
    if (!pTile || !pgcScratch) {
 | 
			
		||||
        if (pTile)
 | 
			
		||||
            (*pTile->drawable.pScreen->DestroyPixmap) (pTile);
 | 
			
		||||
        dixDestroyPixmap(pTile, 0);
 | 
			
		||||
        if (pgcScratch)
 | 
			
		||||
            FreeScratchGC(pgcScratch);
 | 
			
		||||
        return FALSE;
 | 
			
		||||
| 
						 | 
				
			
			@ -669,7 +668,7 @@ CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask)
 | 
			
		|||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            if (!pgcDst->tileIsPixel)
 | 
			
		||||
                (*pgcDst->pScreen->DestroyPixmap) (pgcDst->tile.pixmap);
 | 
			
		||||
                dixDestroyPixmap(pgcDst->tile.pixmap, 0);
 | 
			
		||||
            pgcDst->tileIsPixel = pgcSrc->tileIsPixel;
 | 
			
		||||
            pgcDst->tile = pgcSrc->tile;
 | 
			
		||||
            if (!pgcDst->tileIsPixel)
 | 
			
		||||
| 
						 | 
				
			
			@ -681,7 +680,7 @@ CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask)
 | 
			
		|||
            if (pgcDst->stipple == pgcSrc->stipple)
 | 
			
		||||
                break;
 | 
			
		||||
            if (pgcDst->stipple)
 | 
			
		||||
                (*pgcDst->pScreen->DestroyPixmap) (pgcDst->stipple);
 | 
			
		||||
                dixDestroyPixmap(pgcDst->stipple, 0);
 | 
			
		||||
            pgcDst->stipple = pgcSrc->stipple;
 | 
			
		||||
            if (pgcDst->stipple)
 | 
			
		||||
                pgcDst->stipple->refcnt++;
 | 
			
		||||
| 
						 | 
				
			
			@ -776,9 +775,9 @@ FreeGC(void *value, XID gid)
 | 
			
		|||
        (*pGC->funcs->DestroyClip) (pGC);
 | 
			
		||||
 | 
			
		||||
    if (!pGC->tileIsPixel)
 | 
			
		||||
        (*pGC->pScreen->DestroyPixmap) (pGC->tile.pixmap);
 | 
			
		||||
        dixDestroyPixmap(pGC->tile.pixmap, 0);
 | 
			
		||||
    if (pGC->stipple)
 | 
			
		||||
        (*pGC->pScreen->DestroyPixmap) (pGC->stipple);
 | 
			
		||||
        dixDestroyPixmap(pGC->stipple, 0);
 | 
			
		||||
 | 
			
		||||
    if (pGC->funcs)
 | 
			
		||||
        (*pGC->funcs->DestroyGC) (pGC);
 | 
			
		||||
| 
						 | 
				
			
			@ -886,7 +885,7 @@ CreateDefaultStipple(int screenNum)
 | 
			
		|||
    tmpval[2].val = FillSolid;
 | 
			
		||||
    pgcScratch = GetScratchGC(1, pScreen);
 | 
			
		||||
    if (!pgcScratch) {
 | 
			
		||||
        (*pScreen->DestroyPixmap) (pScreen->defaultStipple);
 | 
			
		||||
        dixDestroyPixmap(pScreen->defaultStipple, 0);
 | 
			
		||||
        return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
    (void) ChangeGC(NullClient, pgcScratch,
 | 
			
		||||
| 
						 | 
				
			
			@ -906,8 +905,7 @@ void
 | 
			
		|||
FreeDefaultStipple(int screenNum)
 | 
			
		||||
{
 | 
			
		||||
    ScreenPtr pScreen = screenInfo.screens[screenNum];
 | 
			
		||||
 | 
			
		||||
    (*pScreen->DestroyPixmap) (pScreen->defaultStipple);
 | 
			
		||||
    dixDestroyPixmap(pScreen->defaultStipple, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -98,8 +98,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm,
 | 
			
		|||
                                                 CREATE_PIXMAP_USAGE_SCRATCH);
 | 
			
		||||
    pGC = GetScratchGC(1, pScreen);
 | 
			
		||||
    if (!ppix || !pGC) {
 | 
			
		||||
        if (ppix)
 | 
			
		||||
            (*pScreen->DestroyPixmap) (ppix);
 | 
			
		||||
        dixDestroyPixmap(ppix, 0);
 | 
			
		||||
        if (pGC)
 | 
			
		||||
            FreeScratchGC(pGC);
 | 
			
		||||
        free(pbits);
 | 
			
		||||
| 
						 | 
				
			
			@ -129,7 +128,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm,
 | 
			
		|||
                          XYPixmap, 1, pbits);
 | 
			
		||||
    *ppbits = (unsigned char *) pbits;
 | 
			
		||||
    FreeScratchGC(pGC);
 | 
			
		||||
    (*pScreen->DestroyPixmap) (ppix);
 | 
			
		||||
    dixDestroyPixmap(ppix, 0);
 | 
			
		||||
    return Success;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth,
 | 
			
		|||
        if ((*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth,
 | 
			
		||||
                                            bitsPerPixel, devKind, pPixData))
 | 
			
		||||
            return pPixmap;
 | 
			
		||||
        (*pScreen->DestroyPixmap) (pPixmap);
 | 
			
		||||
        dixDestroyPixmap(pPixmap, 0);
 | 
			
		||||
    }
 | 
			
		||||
    return NullPixmap;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -73,9 +73,8 @@ void
 | 
			
		|||
FreeScratchPixmapHeader(PixmapPtr pPixmap)
 | 
			
		||||
{
 | 
			
		||||
    if (pPixmap) {
 | 
			
		||||
        ScreenPtr pScreen = pPixmap->drawable.pScreen;
 | 
			
		||||
        pPixmap->devPrivate.ptr = NULL; /* help catch/avoid heap-use-after-free */
 | 
			
		||||
        (*pScreen->DestroyPixmap)(pPixmap);
 | 
			
		||||
        dixDestroyPixmap(pPixmap, 0);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -151,7 +150,7 @@ PixmapPtr PixmapShareToSecondary(PixmapPtr pixmap, ScreenPtr secondary)
 | 
			
		|||
 | 
			
		||||
    ret = secondary->SetSharedPixmapBacking(spix, handle);
 | 
			
		||||
    if (ret == FALSE) {
 | 
			
		||||
        secondary->DestroyPixmap(spix);
 | 
			
		||||
        dixDestroyPixmap(spix, 0);
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										18
									
								
								dix/window.c
								
								
								
								
							
							
						
						
									
										18
									
								
								dix/window.c
								
								
								
								
							| 
						 | 
				
			
			@ -1015,9 +1015,9 @@ FreeWindowResources(WindowPtr pWin)
 | 
			
		|||
    if (wInputShape(pWin))
 | 
			
		||||
        RegionDestroy(wInputShape(pWin));
 | 
			
		||||
    if (pWin->borderIsPixel == FALSE)
 | 
			
		||||
        (*pScreen->DestroyPixmap) (pWin->border.pixmap);
 | 
			
		||||
        dixDestroyPixmap(pWin->border.pixmap, 0);
 | 
			
		||||
    if (pWin->backgroundState == BackgroundPixmap)
 | 
			
		||||
        (*pScreen->DestroyPixmap) (pWin->background.pixmap);
 | 
			
		||||
        dixDestroyPixmap(pWin->background.pixmap, 0);
 | 
			
		||||
 | 
			
		||||
    DeleteAllWindowProperties(pWin);
 | 
			
		||||
    /* We SHOULD check for an error value here XXX */
 | 
			
		||||
| 
						 | 
				
			
			@ -1196,7 +1196,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 | 
			
		|||
                borderRelative = TRUE;
 | 
			
		||||
            if (pixID == None) {
 | 
			
		||||
                if (pWin->backgroundState == BackgroundPixmap)
 | 
			
		||||
                    (*pScreen->DestroyPixmap) (pWin->background.pixmap);
 | 
			
		||||
                    dixDestroyPixmap(pWin->background.pixmap, 0);
 | 
			
		||||
                if (!pWin->parent)
 | 
			
		||||
                    SetRootWindowBackground(pWin, pScreen, &index2);
 | 
			
		||||
                else {
 | 
			
		||||
| 
						 | 
				
			
			@ -1211,7 +1211,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 | 
			
		|||
                    goto PatchUp;
 | 
			
		||||
                }
 | 
			
		||||
                if (pWin->backgroundState == BackgroundPixmap)
 | 
			
		||||
                    (*pScreen->DestroyPixmap) (pWin->background.pixmap);
 | 
			
		||||
                    dixDestroyPixmap(pWin->background.pixmap, 0);
 | 
			
		||||
                if (!pWin->parent)
 | 
			
		||||
                    SetRootWindowBackground(pWin, pScreen, &index2);
 | 
			
		||||
                else
 | 
			
		||||
| 
						 | 
				
			
			@ -1230,7 +1230,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 | 
			
		|||
                        goto PatchUp;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (pWin->backgroundState == BackgroundPixmap)
 | 
			
		||||
                        (*pScreen->DestroyPixmap) (pWin->background.pixmap);
 | 
			
		||||
                        dixDestroyPixmap(pWin->background.pixmap, 0);
 | 
			
		||||
                    pWin->backgroundState = BackgroundPixmap;
 | 
			
		||||
                    pWin->background.pixmap = pPixmap;
 | 
			
		||||
                    pPixmap->refcnt++;
 | 
			
		||||
| 
						 | 
				
			
			@ -1246,7 +1246,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 | 
			
		|||
            if (pWin->backgroundState == ParentRelative)
 | 
			
		||||
                borderRelative = TRUE;
 | 
			
		||||
            if (pWin->backgroundState == BackgroundPixmap)
 | 
			
		||||
                (*pScreen->DestroyPixmap) (pWin->background.pixmap);
 | 
			
		||||
                dixDestroyPixmap(pWin->background.pixmap, 0);
 | 
			
		||||
            pWin->backgroundState = BackgroundPixel;
 | 
			
		||||
            pWin->background.pixel = (CARD32) *pVlist;
 | 
			
		||||
            /* background pixel overrides background pixmap,
 | 
			
		||||
| 
						 | 
				
			
			@ -1265,7 +1265,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 | 
			
		|||
                }
 | 
			
		||||
                if (pWin->parent->borderIsPixel == TRUE) {
 | 
			
		||||
                    if (pWin->borderIsPixel == FALSE)
 | 
			
		||||
                        (*pScreen->DestroyPixmap) (pWin->border.pixmap);
 | 
			
		||||
                        dixDestroyPixmap(pWin->border.pixmap, 0);
 | 
			
		||||
                    pWin->border = pWin->parent->border;
 | 
			
		||||
                    pWin->borderIsPixel = TRUE;
 | 
			
		||||
                    index2 = CWBorderPixel;
 | 
			
		||||
| 
						 | 
				
			
			@ -1284,7 +1284,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 | 
			
		|||
                    goto PatchUp;
 | 
			
		||||
                }
 | 
			
		||||
                if (pWin->borderIsPixel == FALSE)
 | 
			
		||||
                    (*pScreen->DestroyPixmap) (pWin->border.pixmap);
 | 
			
		||||
                    dixDestroyPixmap(pWin->border.pixmap, 0);
 | 
			
		||||
                pWin->borderIsPixel = FALSE;
 | 
			
		||||
                pWin->border.pixmap = pPixmap;
 | 
			
		||||
                pPixmap->refcnt++;
 | 
			
		||||
| 
						 | 
				
			
			@ -1297,7 +1297,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 | 
			
		|||
            break;
 | 
			
		||||
        case CWBorderPixel:
 | 
			
		||||
            if (pWin->borderIsPixel == FALSE)
 | 
			
		||||
                (*pScreen->DestroyPixmap) (pWin->border.pixmap);
 | 
			
		||||
                dixDestroyPixmap(pWin->border.pixmap, 0);
 | 
			
		||||
            pWin->borderIsPixel = TRUE;
 | 
			
		||||
            pWin->border.pixel = (CARD32) *pVlist;
 | 
			
		||||
            /* border pixel overrides border pixmap,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue