From 6a91e06c20b59e107ca46317057eecf06fdd15ac Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 29 May 2015 14:00:24 +0100 Subject: [PATCH] pixmap: Allow PixmapShareToSlave to be optionally implemented This is just defense in depth, for if we get this far we expect that the slave DDX to have declared that it is an output sink and so have the corresponding interface hooks. However, if those vfuncs are NULL let's just report failure rather than crash. References: https://bugs.freedesktop.org/show_bug.cgi?id=90771 Signed-off-by: Chris Wilson --- dix/pixmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dix/pixmap.c b/dix/pixmap.c index d691127..cd7df46 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -138,7 +138,9 @@ PixmapPtr PixmapShareToSlave(PixmapPtr pixmap, ScreenPtr slave) ScreenPtr master = pixmap->drawable.pScreen; int depth = pixmap->drawable.depth; - ret = master->SharePixmapBacking(pixmap, slave, &handle); + ret = FALSE; + if (master->SharePixmapBacking) + ret = master->SharePixmapBacking(pixmap, slave, &handle); if (ret == FALSE) return NULL; @@ -154,7 +156,9 @@ PixmapPtr PixmapShareToSlave(PixmapPtr pixmap, ScreenPtr slave) spix->master_pixmap = pixmap; - ret = slave->SetSharedPixmapBacking(spix, handle); + ret = FALSE; + if (slave->SetSharedPixmapBacking) + ret = slave->SetSharedPixmapBacking(spix, handle); if (ret == FALSE) { slave->DestroyPixmap(spix); return NULL; -- 2.1.4