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 <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1709>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-09-30 17:36:05 +02:00 committed by Marge Bot
parent ef62929f58
commit 24d693c5ae

View File

@ -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