diff options
author | Enrico Weigelt, metux IT consult <info@metux.net> | 2024-09-30 18:29:41 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2025-02-06 23:00:25 +0000 |
commit | 92cc4534146dd84c0d843759cdb30f75abddddd6 (patch) | |
tree | 80bb695405ef3560fe60c6a946f239cdeea0f684 | |
parent | 3a7a8084fea33213de8b5999219697168e256386 (diff) |
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead - except when calling down the
chain where we had wrapped ourselves - and protecting those against NULL, so
we can move subsys-provided functions out of that chain.
See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-vmware/-/merge_requests/11>
-rw-r--r-- | saa/saa.c | 2 | ||||
-rw-r--r-- | saa/saa_pixmap.c | 8 | ||||
-rw-r--r-- | saa/saa_render.c | 6 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_crtc.c | 2 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_dri2.c | 2 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_dri3.c | 2 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_saa.c | 2 |
7 files changed, 13 insertions, 11 deletions
@@ -627,7 +627,7 @@ saa_early_close_screen(CLOSE_SCREEN_ARGS_DECL) * is the last chance we have of releasing our resources * associated with the Pixmap. So do it first. */ - (void)(*pScreen->DestroyPixmap) (pScreen->devPrivate); + dixDestroyPixmap(pScreen->devPrivate, 0); pScreen->devPrivate = NULL; } diff --git a/saa/saa_pixmap.c b/saa/saa_pixmap.c index 240d609..188e7d7 100644 --- a/saa/saa_pixmap.c +++ b/saa/saa_pixmap.c @@ -104,7 +104,8 @@ saa_create_pixmap(ScreenPtr pScreen, int w, int h, int depth, driver->destroy_pixmap(driver, pPixmap); out_no_driver_priv: saa_swap(sscreen, pScreen, DestroyPixmap); - pScreen->DestroyPixmap(pPixmap); + if (pScreen->DestroyPixmap) + pScreen->DestroyPixmap(pPixmap); saa_swap(sscreen, pScreen, DestroyPixmap); out_no_pix: LogMessage(X_ERROR, "Failing pixmap creation.\n"); @@ -116,7 +117,7 @@ saa_destroy_pixmap(PixmapPtr pPixmap) { ScreenPtr pScreen = pPixmap->drawable.pScreen; struct saa_screen_priv *sscreen = saa_screen(pScreen); - Bool ret; + Bool ret = TRUE; struct saa_driver *driver = sscreen->driver; if (pPixmap->refcnt == 1) { @@ -139,7 +140,8 @@ saa_destroy_pixmap(PixmapPtr pPixmap) } saa_swap(sscreen, pScreen, DestroyPixmap); - ret = pScreen->DestroyPixmap(pPixmap); + if (pScreen->DestroyPixmap) + ret = pScreen->DestroyPixmap(pPixmap); saa_swap(sscreen, pScreen, DestroyPixmap); return ret; diff --git a/saa/saa_render.c b/saa/saa_render.c index c6ce68c..5a6b899 100644 --- a/saa/saa_render.c +++ b/saa/saa_render.c @@ -67,8 +67,8 @@ saa_create_alpha_picture(ScreenPtr pScreen, return 0; pGC = GetScratchGC(pPixmap->drawable.depth, pScreen); if (!pGC) { - (*pScreen->DestroyPixmap) (pPixmap); - return 0; + dixDestroyPixmap(pPixmap, 0); + return 0; } ValidateGC(&pPixmap->drawable, pGC); rect.x = 0; @@ -79,7 +79,7 @@ saa_create_alpha_picture(ScreenPtr pScreen, FreeScratchGC(pGC); pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat, 0, 0, serverClient, &error); - (*pScreen->DestroyPixmap) (pPixmap); + dixDestroyPixmap(pPixmap, 0); return pPicture; } diff --git a/vmwgfx/vmwgfx_crtc.c b/vmwgfx/vmwgfx_crtc.c index 7321e20..d06acb2 100644 --- a/vmwgfx/vmwgfx_crtc.c +++ b/vmwgfx/vmwgfx_crtc.c @@ -295,7 +295,7 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) return; pScreen = rotate_pixmap->drawable.pScreen; - pScreen->DestroyPixmap(rotate_pixmap); + dixDestroyPixmap(rotate_pixmap, 0); } diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c index 8e04f6c..92e2c67 100644 --- a/vmwgfx/vmwgfx_dri2.c +++ b/vmwgfx/vmwgfx_dri2.c @@ -245,7 +245,7 @@ dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer) WSBMLISTDELINIT(&vpix->sync_x_head); private->srf = NULL; - pScreen->DestroyPixmap(private->pPixmap); + dixDestroyPixmap(private->pPixmap, 0); } diff --git a/vmwgfx/vmwgfx_dri3.c b/vmwgfx/vmwgfx_dri3.c index 0d4be5c..7fb52ee 100644 --- a/vmwgfx/vmwgfx_dri3.c +++ b/vmwgfx/vmwgfx_dri3.c @@ -145,7 +145,7 @@ vmwgfx_dri3_pixmap_from_fd(ScreenPtr screen, int fd, out_no_damage: xa_surface_unref(srf); out_bad_format: - screen->DestroyPixmap(pixmap); + dixDestroyPixmap(pixmap, 0); return NULL; } diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c index 457f397..62db1de 100644 --- a/vmwgfx/vmwgfx_saa.c +++ b/vmwgfx/vmwgfx_saa.c @@ -1595,7 +1595,7 @@ vmwgfx_scanout_unref(struct vmwgfx_screen_entry *entry) } entry->pixmap = NULL; - pixmap->drawable.pScreen->DestroyPixmap(pixmap); + dixDestroyPixmap(pixmap, 0); } void |