xf86-video-intel: src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Mar 4 09:16:43 PST 2015


 src/sna/sna_display.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

New commits:
commit db82617464e55432522e6199a88408ff0187f6ff
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Mar 4 17:12:30 2015 +0000

    sna: Decouple RandR pointers early in CloseScreen
    
    RR resources are freed before CloseScreen (as they are a ServerClient
    resource), but on entering our CloseScreen callbacks we are left with a
    set of stale pointers. Decouple those before proceeding so that we are
    not tempted to dereference them.
    
    Bugzilla: https://bugs.archlinux.org/task/43906
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 88db508..fd6c46c 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -6292,9 +6292,26 @@ sna_mode_enable(struct sna *sna)
 	sna->mode.dirty = false;
 }
 
+static void sna_randr_close(struct sna *sna)
+{
+	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
+	int n;
+
+	/* The RR structs are freed early during CloseScreen as they
+	 * are tracked as Resources. However, we may be tempted to
+	 * access them during shutdown so decouple them now.
+	 */
+	  for (n = 0; n < config->num_output; n++)
+		  config->output[n]->randr_output = NULL;
+
+	  for (n = 0; n < config->num_crtc; n++)
+		  config->crtc[n]->randr_crtc = NULL;
+}
+
 void
 sna_mode_close(struct sna *sna)
 {
+	sna_randr_close(sna);
 	sna_mode_wakeup(sna);
 
 	if (sna->flags & SNA_IS_HOSTED)


More information about the xorg-commit mailing list