diff options
author | Alex Goins <agoins@nvidia.com> | 2020-07-02 20:03:06 -0500 |
---|---|---|
committer | Alex Goins <agoins@nvidia.com> | 2020-07-21 15:53:53 +0000 |
commit | 495bf63a7df066672d9d44dedeb1f49658a247d8 (patch) | |
tree | 8bcb85aed9606ea87c80d51c1dda04d56c7d1a0d | |
parent | 8eeff5d7880c6885ee6f206355599f13d739afa7 (diff) |
randr: Re-add removed NULL checks to xf86RandR12.c
Commit 1e3f9ea1 removed some NULL checks from xf86RandR12.c, on the premise that
they can't be reached unless RandR has already been initialized. For threesuch
calls, that's not true:
xf86Crtc.c::xf86CrtcScreenInit():
if (c == config->num_crtc) {
xf86RandR12SetRotations(screen, RR_Rotate_0 | RR_Rotate_90 |
RR_Rotate_180 | RR_Rotate_270 |
RR_Reflect_X | RR_Reflect_Y);
xf86RandR12SetTransformSupport(screen, TRUE);
}
else {
xf86RandR12SetRotations(screen, RR_Rotate_0);
xf86RandR12SetTransformSupport(screen, FALSE);
}
xf86Crtc.c::xf86CrtcCloseScreen():
xf86RandR12CloseScreen(screen);
This change adds checks back to xf86RandR12Set{Rotations,TransformSupport}() and
xf86RandR12CloseScreen(), checking that xf86RandR12KeyRec has been registered.
Without this, X will hit an assert that causes it to abort.
Signed-off-by: Alex Goins <agoins@nvidia.com>
-rw-r--r-- | hw/xfree86/modes/xf86RandR12.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 08b8d66d8..50cbd043e 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -901,6 +901,9 @@ xf86RandR12CloseScreen(ScreenPtr pScreen) { XF86RandRInfoPtr randrp; + if (!dixPrivateKeyRegistered(&xf86RandR12KeyRec)) + return; + randrp = XF86RANDRINFO(pScreen); #if RANDR_12_INTERFACE xf86ScreenToScrn(pScreen)->EnterVT = randrp->orig_EnterVT; @@ -922,6 +925,9 @@ xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotations) xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); #endif + if (!dixPrivateKeyRegistered(&xf86RandR12KeyRec)) + return; + randrp = XF86RANDRINFO(pScreen); #if RANDR_12_INTERFACE for (c = 0; c < config->num_crtc; c++) { @@ -941,6 +947,9 @@ xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms) int c; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + if (!dixPrivateKeyRegistered(&xf86RandR12KeyRec)) + return; + for (c = 0; c < config->num_crtc; c++) { xf86CrtcPtr crtc = config->crtc[c]; |