From f958be1d48b7a75a4044a3db8a2b25c7c44662a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Piel?= Date: Thu, 10 Jun 2010 19:53:25 +0200 Subject: [PATCH] exa: fix ExaCheckCopyNtoN for exa_classic when source = dest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Yves De Muyter In case you want to copy a region with source = dest, you have the same pixmap as source and dest. At the end of exaPixmapIsOffscreen_classic() the devPrivate.ptr is reset to NULL (look at the sources). Now this is what happens in ExaCheckCopyNtoN: exaPrepareAccess( pDst ); Calls IsOffscreen() sets devPrivate.ptr to NULL sets up devPrivate.ptr to real pointer Everything OK exaPrepareAccess( pSrc ); Calls IsOffscreen() sets devPrivate.ptr to NULL BAILS OUT CAUSE OF NESTED OPERATION SINCE DST EQUALS SRC We end up with devPrivate.ptr as NULL, and that is clearly wrong. In particular this fixes a segfault when using the psb driver (bug 28077) Signed-off-by: Éric Piel --- exa/exa_classic.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/exa/exa_classic.c b/exa/exa_classic.c index 12f3987..28cc421 100644 --- a/exa/exa_classic.c +++ b/exa/exa_classic.c @@ -256,9 +256,10 @@ exaPixmapIsOffscreen_classic(PixmapPtr pPixmap) Bool ret; if (pExaScr->info->PixmapIsOffscreen) { + void* old_ptr = pPixmap->devPrivate.ptr; pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap); ret = pExaScr->info->PixmapIsOffscreen(pPixmap); - pPixmap->devPrivate.ptr = NULL; + pPixmap->devPrivate.ptr = old_ptr; } else ret = (pExaPixmap->offscreen && pExaPixmap->fb_ptr); -- 1.7.1