From 24d693c5ae89fa10b1204ffaea128c4a7e2dc25f Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 30 Sep 2024 17:36:05 +0200 Subject: [PATCH] dix: make dixDestroyPixmap() NULL-proof Make dixDestroyPixmap() check for NULL pointer, so callers don't need to do it anymore. Returning TRUE on NULL pointer - but most callers won't even look at the retval anyways. Together with subsequent commits, which will make use of that function, instead of calling raw ScreenRec->DestroyPixmap vectors, this gives us some more freedom for architectural changes, eg. get rid of the extremely complicated and fragile wrapping chains. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- dix/dispatch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index 1c40bd2ca..5f7cfe02d 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1462,8 +1462,9 @@ int dixDestroyPixmap(void *value, XID pid) { PixmapPtr pPixmap = (PixmapPtr) value; - - return (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap); + if (pPixmap && pPixmap->drawable.pScreen && pPixmap->drawable.pScreen->DestroyPixmap) + return pPixmap->drawable.pScreen->DestroyPixmap(pPixmap); + return TRUE; } int