Skip to content

Commit

Permalink
Clean up RandR12 bits on screen close (bug 27114)
Browse files Browse the repository at this point in the history
When resetting the server, pScrn->EnterVT must be unwrapped or the
next server generation will end up wrapping the wrapper and causing an
infinite recursion on EnterVT.

Signed-off-by: Keith Packard <[email protected]>
Tested-by: Michael Stapelberg <[email protected]>
  • Loading branch information
keith-packard committed Jun 15, 2010
1 parent d5ab717 commit 68a9ee8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 2 additions & 0 deletions hw/xfree86/modes/xf86Crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,8 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen)

crtc->randr_crtc = NULL;
}
xf86RandR12CloseScreen (screen);

return screen->CloseScreen (index, screen);
}

Expand Down
26 changes: 25 additions & 1 deletion hw/xfree86/modes/xf86RandR12.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,24 @@ xf86RandR12Init (ScreenPtr pScreen)
return TRUE;
}

void
xf86RandR12CloseScreen (ScreenPtr pScreen)
{
XF86RandRInfoPtr randrp;

#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL)
return;
#endif

randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE
xf86Screens[pScreen->myNum]->EnterVT = randrp->orig_EnterVT;
#endif

free(randrp);
}

void
xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
{
Expand Down Expand Up @@ -1755,10 +1773,16 @@ static Bool
xf86RandR12EnterVT (int screen_index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[screen_index];
ScrnInfoPtr pScrn = xf86Screens[screen_index];
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
Bool ret;

if (randrp->orig_EnterVT) {
if (!randrp->orig_EnterVT (screen_index, flags))
pScrn->EnterVT = randrp->orig_EnterVT;
ret = pScrn->EnterVT (screen_index, flags);
randrp->orig_EnterVT = pScrn->EnterVT;
pScrn->EnterVT = xf86RandR12EnterVT;
if (!ret)
return FALSE;
}

Expand Down
1 change: 1 addition & 0 deletions hw/xfree86/modes/xf86RandR12.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

extern _X_EXPORT Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen);
extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen);
extern _X_EXPORT void xf86RandR12CloseScreen(ScreenPtr pScreen);
extern _X_EXPORT void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotation);
extern _X_EXPORT void xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms);
extern _X_EXPORT Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate,
Expand Down

0 comments on commit 68a9ee8

Please sign in to comment.