From daece9dc8f46a5b5340772518730317bad7f2948 Mon Sep 17 00:00:00 2001 From: Benjamin Close Date: Fri, 15 Feb 2008 13:36:34 +1030 Subject: [PATCH] dix: Handle the case where a device cursor was removed correctly In the case that the device cursor was the first in the list of cursors the window knew about, unsetting the cursor could lead to a segfault due to pPrev being NULL. Instead catch the condition and correctly remove the node from the list. Since there is no cursor now set on the device, we simply return success as the parent windows cursor will propogate down later. --- dix/window.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/dix/window.c b/dix/window.c index d937ca8..01e1074 100644 --- a/dix/window.c +++ b/dix/window.c @@ -3822,8 +3822,14 @@ ChangeWindowDeviceCursor(WindowPtr pWin, if (!pCursor) /* remove from list */ { - pPrev->next = pNode->next; + if(pPrev) + pPrev->next = pNode->next; + else + /* first item in list */ + pWin->optional->deviceCursors=pNode->next; + xfree(pNode); + return Success; } } else -- 1.5.3.2