From e271e6261db4825eee34ccd2272158bd2e6dd5f7 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 30 Sep 2024 17:36:05 +0200 Subject: [PATCH] (!1709) 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 --- dix/dispatch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index c25e372d9..f04c79895 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