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

Bug#965382: Regression: Cinnamon segfault with muffin due to getting refresh rates from xrandr



Package: muffin
Version: 4.6.2-2
Severity: normal
Tags: patch
X-Debbugs-Cc: itzswirlz2020@outlook.com

I'm going to make this short, simple, and easy

Since Cinnamon 4.0.0 there was a regression that when they got refresh rates
from xrandr, sometimes the output would be null and that would cause other
segfaults.

This is a regression from Cinnamon 4.0.0. To replicate it now in 4.6.6, the
latest release of muffin includes this patch.

To replicate the bug is complicated: turn off a laptop monitor, turn on the
external, something along the lines of that. Read the upstream bug reports and
commit:

https://github.com/linuxmint/cinnamon/issues/9401

https://github.com/linuxmint/muffin/commit/c092579b67febb7e2a49361942f20f78c82f968e

The patch is made from GitHub's commit change-so add the patch attached, fill
in debian/changelog and go.



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.7.0-1-amd64 (SMP w/1 CPU thread)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages muffin depends on:
ii  libc6               2.31-1
ii  libcairo2           1.16.0-4
ii  libgdk-pixbuf2.0-0  2.40.0+dfsg-5
ii  libglib2.0-0        2.64.4-1
ii  libgtk-3-0          3.24.20-1
ii  libmuffin0          4.6.2-2
ii  libpango-1.0-0      1.44.7-4
ii  libx11-6            2:1.6.9-2+b1
ii  libxcomposite1      1:0.4.5-1
ii  muffin-common       4.6.2-2
ii  zenity              3.32.0-5

Versions of packages muffin recommends:
ii  cinnamon-session [x-session-manager]  4.6.1-2

Versions of packages muffin suggests:
ii  cinnamon-control-center  4.6.1-1
ii  xdg-user-dirs            0.17-2

-- no debconf information
>From c092579b67febb7e2a49361942f20f78c82f968e Mon Sep 17 00:00:00 2001
From: Michael Webster <miketwebster@gmail.com>
Date: Sun, 19 Jul 2020 15:04:45 -0400
Subject: [PATCH] screen.c: Check for MetaMonitorInfo being non-null before
 attempting to access it.

The return from find_monitor_with_rect() is usually null (there are
lots of modes usually), but this is never guarded against when collecting
refresh rates.

Example to reproduce: Laptop monitor + external monitor.  Arrange laptop
monitor to the right of the external one.  Using nvidia-450 (confirmed
for me, at least), turn laptop monitor off.  Ignoring horrible lag from
driver, turn the laptop monitor back on (arranging it still to the right
of the external monitor).

regression from:
https://github.com/linuxmint/muffin/commit/1d38120c9ded2578a14cb2e8bf46bb82b3acdc75
---
 src/core/screen.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/core/screen.c b/src/core/screen.c
index a779e0743..5c3d1d96c 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -635,18 +635,22 @@ reload_monitor_infos (MetaScreen *screen)
 
                 crtc = XRRGetCrtcInfo (display->xdisplay, resources, resources->crtcs[i]);
                 info = find_monitor_with_rect (screen, crtc->x, crtc->y, (int)crtc->width, (int)crtc->height);
-                for (j = 0; j < resources->nmode; j++)
+
+                if (info)
                   {
-                    if (resources->modes[j].id == crtc->mode)
-                      info->refresh_rate = (resources->modes[j].dotClock /
-                                            ((float)resources->modes[j].hTotal *
-                                            resources->modes[j].vTotal));
+                    for (j = 0; j < resources->nmode; j++)
+                      {
+                        if (resources->modes[j].id == crtc->mode)
+                          info->refresh_rate = (resources->modes[j].dotClock /
+                                                ((float)resources->modes[j].hTotal *
+                                                resources->modes[j].vTotal));
+                      }
+                    info->output = find_main_output_for_crtc (screen, resources, crtc);
                   }
-                if (info)
-                  info->output = find_main_output_for_crtc (screen, resources, crtc);
 
                 XRRFreeCrtcInfo (crtc);
               }
+
             XRRFreeScreenResources (resources);
           }
       }


Reply to: