From c8acb342695936db062c966029019a458d45459e Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Thu, 16 Feb 2006 06:52:12 +0000 Subject: [PATCH] Fix an occasional crash on VT switches: the server would save a pointer to the current cursor when disabling FB access and would try to restore that cursor when re-enabling. However, that cursor might have been destroyed in between. This fixes it by updating the saved cursor pointer when a cursor is set and vtSema is FALSE. --- ChangeLog | 10 ++++++++++ hw/xfree86/ramdac/xf86Cursor.c | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dd8339ebc..2ca7eae02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-02-16 Benjamin Herrenschmidt + + * hw/xfree86/ramdac/xf86Cursor.c: + (xf86CursorEnableDisableFBAccess), (xf86CursorSetCursor): + Fix an occasional crash on VT switches: the server would save a + pointer to the current cursor when disabling FB access and would try + to restore that cursor when re-enabling. However, that cursor might + have been destroyed in between. This fixes it by updating the saved + cursor pointer when a cursor is set and vtSema is FALSE. + 2006-02-15 Eric Anholt * XTrap/Makefile.am: diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c index a930cdd8e..17a49669d 100644 --- a/hw/xfree86/ramdac/xf86Cursor.c +++ b/hw/xfree86/ramdac/xf86Cursor.c @@ -198,7 +198,6 @@ xf86CursorEnableDisableFBAccess( ScreenPtr pScreen = screenInfo.screens[index]; xf86CursorScreenPtr ScreenPriv = pScreen->devPrivates[xf86CursorScreenIndex].ptr; - xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; if (!enable && ScreenPriv->CurrentCursor != NullCursor) { ScreenPriv->SavedCursor = ScreenPriv->CurrentCursor; @@ -291,6 +290,9 @@ xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) ScreenPriv->y = y; ScreenPriv->CursorToRestore = NULL; + if (!infoPtr->pScrn->vtSema) + ScreenPriv->SavedCursor = pCurs; + if (pCurs == NullCursor) { /* means we're supposed to remove the cursor */ if (ScreenPriv->SWCursor) (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, NullCursor, x, y);