diff --git a/exa/exa_classic.c b/exa/exa_classic.c index 05f0ff2a8..7f93f1e3d 100644 --- a/exa/exa_classic.c +++ b/exa/exa_classic.c @@ -96,9 +96,10 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, pExaPixmap->fb_size = pExaPixmap->fb_pitch * h; if (pExaPixmap->fb_pitch > 131071) { - // don't need to protect from calling our own (wrapped) DestroyPixmap - // handler, because it can deal with half-initialized state - dixDestroyPixmap(pPixmap, 0); + swap(pExaScr, pScreen, DestroyPixmap); + if (pScreen->DestroyPixmap) + pScreen->DestroyPixmap(pPixmap); + swap(pExaScr, pScreen, DestroyPixmap); return NULL; } @@ -108,9 +109,10 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, pScreen, pPixmap); if (pExaPixmap->pDamage == NULL) { - // don't need to protect from calling our own (wrapped) DestroyPixmap - // handler, because it can deal with half-initialized state - dixDestroyPixmap(pPixmap, 0); + swap(pExaScr, pScreen, DestroyPixmap); + if (pScreen->DestroyPixmap) + pScreen->DestroyPixmap(pPixmap); + swap(pExaScr, pScreen, DestroyPixmap); return NULL; } @@ -216,8 +218,6 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); - if (!pExaPixmap) // we're called on an error path - goto out; exaDestroyPixmap(pPixmap); @@ -235,10 +235,9 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap) RegionUninit(&pExaPixmap->validFB); } -out: - // restore original (screen driver's) DestroyPixmap() handler and call it swap(pExaScr, pScreen, DestroyPixmap); - dixDestroyPixmap(pPixmap, 0); + if (pScreen->DestroyPixmap) + ret = pScreen->DestroyPixmap(pPixmap); swap(pExaScr, pScreen, DestroyPixmap); return ret; diff --git a/exa/exa_driver.c b/exa/exa_driver.c index e56f980c7..17106fcb9 100644 --- a/exa/exa_driver.c +++ b/exa/exa_driver.c @@ -98,9 +98,10 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, } if (!pExaPixmap->driverPriv) { - // don't need to protect from calling our own (wrapped) DestroyPixmap - // handler, because it can deal with half-initialized state - dixDestroyPixmap(pPixmap, 0); + swap(pExaScr, pScreen, DestroyPixmap); + if (pScreen->DestroyPixmap) + pScreen->DestroyPixmap(pPixmap); + swap(pExaScr, pScreen, DestroyPixmap); return NULL; } @@ -195,8 +196,6 @@ exaDestroyPixmap_driver(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); - if (!pExaPixmap) // we're called on an error path - goto out; exaDestroyPixmap(pPixmap); @@ -205,10 +204,9 @@ exaDestroyPixmap_driver(PixmapPtr pPixmap) pExaPixmap->driverPriv = NULL; } -out: - // restore original (screen driver's) DestroyPixmap() handler and call it swap(pExaScr, pScreen, DestroyPixmap); - dixDestroyPixmap(pPixmap, 0); + if (pScreen->DestroyPixmap) + ret = pScreen->DestroyPixmap(pPixmap); swap(pExaScr, pScreen, DestroyPixmap); return ret; diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c index 340c45a1f..7138f9b30 100644 --- a/exa/exa_mixed.c +++ b/exa/exa_mixed.c @@ -249,8 +249,6 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); - if (!pExaPixmap) - goto out; // we're called on an error path exaDestroyPixmap(pPixmap); @@ -268,10 +266,9 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap) } } -out: - // restore original (screen driver's) DestroyPixmap() handler and call it swap(pExaScr, pScreen, DestroyPixmap); - dixDestroyPixmap(pPixmap, 0); + if (pScreen->DestroyPixmap) + ret = pScreen->DestroyPixmap(pPixmap); swap(pExaScr, pScreen, DestroyPixmap); return ret;