diff options
author | Benjamin Close <Benjamin.Close@clearchain.com> | 2008-02-15 13:36:34 +1030 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-02-18 16:39:19 +1030 |
commit | 660739c6bc84cb74f43a277052ce163fae654417 (patch) | |
tree | ac8da13c71dbd5f76c6abbca9de052acb4acaf82 | |
parent | 24db28230120ecc2b65b25164b6e7b407970f9e2 (diff) |
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.
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
-rw-r--r-- | dix/window.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/dix/window.c b/dix/window.c index 3b69e4547..a941dacd7 100644 --- a/dix/window.c +++ b/dix/window.c @@ -3823,8 +3823,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 |