[mutter] monitor-manager-xrandr: Don't try to disable disabled CRTC



commit 9fa56176fd5c95b609cc52b594baa47880961aa9
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Wed Feb 26 16:10:12 2020 +0100

    monitor-manager-xrandr: Don't try to disable disabled CRTC
    
    When applying a configuration to XRANDR, we first disable CRTCs that
    happen to extend outside of the to-be X11 screen size. While doing so,
    we fail to actually check whether the CRTC is active or not, meaning
    we'll try to query the content of the CRTC configuration even though it
    has none, leading to a NULL pointer dereference.
    
    Fix this by simply ignoring non-configured CRTCs.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1093

 src/backends/x11/meta-monitor-manager-xrandr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index 9531bb276..fd105c07a 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -400,9 +400,13 @@ apply_crtc_assignments (MetaMonitorManager *manager,
     {
       MetaCrtcInfo *crtc_info = crtcs[i];
       MetaCrtc *crtc = crtc_info->crtc;
-      MetaCrtcConfig *crtc_config = crtc->config;
+      MetaCrtcConfig *crtc_config;
       int x2, y2;
 
+      crtc_config = crtc->config;
+      if (!crtc_config)
+        continue;
+
       x2 = (int) roundf (crtc_config->layout.origin.x +
                          crtc_config->layout.size.width);
       y2 = (int) roundf (crtc_config->layout.origin.y +


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]