Reviewed-by: Adam Jackson Signed-off-by: Keith Packard Cc: thellstrom@vmware.com Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=106960 --- hw/xfree86/modes/xf86Crtc.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 4aa77a2..142ab1e 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -734,14 +734,11 @@ xf86CrtcCloseScreen(ScreenPtr screen) xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int o, c; - screen->CloseScreen = config->CloseScreen; - - xf86RotateCloseScreen(screen); - - xf86RandR12CloseScreen(screen); - - screen->CloseScreen(screen); - + /* The randr_output and randr_crtc pointers are already invalid as + * the DIX resources were freed when the associated resources were + * freed. Clear them now; referencing through them during the rest + * of the CloseScreen sequence will not end well. + */ for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; @@ -752,6 +749,15 @@ xf86CrtcCloseScreen(ScreenPtr screen) crtc->randr_crtc = NULL; } + + screen->CloseScreen = config->CloseScreen; + + xf86RotateCloseScreen(screen); + + xf86RandR12CloseScreen(screen); + + screen->CloseScreen(screen); + /* detach any providers */ if (config->randr_provider) { RRProviderDestroy(config->randr_provider); -- cgit v1.1