From 238a4b68197bce7c99d37cbefedde2a1b824a9b2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 Jan 2020 19:55:02 +0100 Subject: Xext: Fix cursor reference counting hazard. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of this xorg-xserver patch: commit 3083c5d0c4386cdd7083b7a83ac72fdad2f1e61e Author: Michel Dänzer Date: Mon Mar 22 18:01:17 2010 +0100 Xext: Fix cursor reference counting hazard. 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 --- nx-X11/programs/Xserver/Xext/saver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/Xext/saver.c b/nx-X11/programs/Xserver/Xext/saver.c index 65c43f6b4..a068b25ee 100644 --- a/nx-X11/programs/Xserver/Xext/saver.c +++ b/nx-X11/programs/Xserver/Xext/saver.c @@ -642,10 +642,10 @@ CreateSaverWindow (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; -- cgit v1.2.3