From d33b3bf41b92e088e7aacbbcb01df18bae50baa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 22 Mar 2010 18:01:17 +0100 Subject: [PATCH] Xext: Fix cursor reference counting hazard. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure the reference count of the new cursor is increased before the old one is decreased, otherwise bad things will happen if they're one and the same and the reference count is 1 initially. Not sure this can actually happen here, but better safe than sorry. Signed-off-by: Michel Dänzer Reviewed-by: Roland Scheidegger Signed-off-by: Keith Packard (cherry picked from commit 3083c5d0c4386cdd7083b7a83ac72fdad2f1e61e) Signed-off-by: Peter Hutterer --- Xext/saver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xext/saver.c b/Xext/saver.c index 04e6497bd..1f54a2c55 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -618,10 +618,10 @@ CreateSaverWindow (ScreenPtr pScreen) FreeResource (pWin->drawable.id, RT_NONE); return FALSE; } + pAttr->pCursor->refcnt++; if (pWin->optional->cursor) FreeCursor (pWin->optional->cursor, (Cursor)0); pWin->optional->cursor = pAttr->pCursor; - pAttr->pCursor->refcnt++; pWin->cursorIsNone = FALSE; CheckWindowOptionalNeed (pWin); mask |= CWCursor;