linuxmint / cinnamon-control-center

A collection of configuration plugins used in cinnamon-settings
GNU General Public License v2.0
62 stars 67 forks source link

Segfault in display panel with 5.4.2 #288

Closed WolleTD closed 2 years ago

WolleTD commented 2 years ago
 * cinnamon-control-center version 5.4.2
 * Distribution - Arch
 * AMD RX580, amdgpu on Kernel 5.17.9
 * 64 bit

Issue

I just updated from cinnamon 5.2 to cinnamon 5.4 and my monitor configuration broke. Trying to open the display settings results in a segmentation fault. I tracked that down to this line: https://github.com/linuxmint/cinnamon-control-center/blob/52220ec0c7cad82a6f52d711fa7dc39eb19067ee/panels/display/cc-display-arrangement.c#L116

where cc_display_monitor_get_preferred_mode (output) returns null because preferred_mode isn't set on that specific CcDisplayMonitorDBus struct.

Debug output (the scaled geometry line was added by me, right before above mentioned L116):

$ cinnamon-control-center -v display

(cinnamon-control-center:52938): Gtk-WARNING **: 16:12:35.512: Theme parsing error: gtk-contained.css:2871:228: Missing closing bracket for :not()
** (cinnamon-control-center:52938): DEBUG: 16:12:35.617: Enabling debugging
** (cinnamon-control-center:52938): DEBUG: 16:12:35.630: No extra argument
(cinnamon-control-center:52938): GLib-GIO-DEBUG: 16:12:35.637: _g_io_module_get_default: Found default implementation dconf (DConfSettingsBackend) for ‘gsettings-backend’
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.637: watch_fast: "/org/cinnamon/muffin/" (establishing: 0, active: 0)
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.638: watch_established: "/org/cinnamon/muffin/" (establishing: 1)
** (cinnamon-control-center:52938): DEBUG: 16:12:35.651: SensorProxy vanished
** (cinnamon-control-center:52938): DEBUG: 16:12:35.651: Has no accelerometer
** (cinnamon-control-center:52938): DEBUG: 16:12:35.651: Muffin appeared
** (cinnamon-control-center:52938): DEBUG: 16:12:35.664: Resetting current config!
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.664: watch_fast: "/org/cinnamon/muffin/" (establishing: 0, active: 1)
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.664: watch_fast: "/org/cinnamon/muffin/" (establishing: 0, active: 2)
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.665: unwatch_fast: "/org/cinnamon/muffin/" (active: 3, establishing: 0)
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.669: watch_fast: "/org/cinnamon/muffin/" (establishing: 0, active: 2)
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.669: unwatch_fast: "/org/cinnamon/muffin/" (active: 3, establishing: 0)
** (cinnamon-control-center:52938): DEBUG: 16:12:35.671: Resetting current config!
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.671: watch_fast: "/org/cinnamon/muffin/" (establishing: 0, active: 2)
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.671: watch_fast: "/org/cinnamon/muffin/" (establishing: 0, active: 3)
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.672: unwatch_fast: "/org/cinnamon/muffin/" (active: 4, establishing: 0)
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.672: unwatch_fast: "/org/cinnamon/muffin/" (active: 3, establishing: 0)
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.675: watch_fast: "/org/cinnamon/muffin/" (establishing: 0, active: 2)
(cinnamon-control-center:52938): dconf-DEBUG: 16:12:35.675: unwatch_fast: "/org/cinnamon/muffin/" (active: 3, establishing: 0)
scaled geometry... (nil) 0x7ffcb8e15bcc 0x7ffcb8e15bc8!
[1]    52938 segmentation fault (core dumped)  cinnamon-control-center -v display

I also printed monitor names to addresses and ran this multiple times, it seems the AOC 24G2W1G4 receives no preferred mode for some reason:

$ cinnamon-control-center display

(cinnamon-control-center:49972): Gtk-WARNING **: 16:02:17.300: Theme parsing error: gtk-contained.css:2871:228: Missing closing bracket for :not()
Display on 0x5628247c75b0 name: 24G2W1G4
Display on 0x562824b3f480 name: DELL U2312HM
Display on 0x562824b3f530 name: 24G2W1G4
Display on 0x562824b3f5e0 name: DELL U2312HM
Display on 0x562824b87030 name: 24G2W1G4
Display on 0x562824b870e0 name: DELL U2312HM
Display on 0x562824b3f740 name: 24G2W1G4
Display on 0x562824b3f690 name: DELL U2312HM
Display on 0x562824b87030 name: 24G2W1G4
Display on 0x562824b870e0 name: DELL U2312HM
Display on 0x5628247c75b0 name: 24G2W1G4
Display on 0x562824b3f480 name: DELL U2312HM
We are actually here 0x562824b3f740 0x562824b3f740 (nil)!
scaled geometry... (nil) 0x7fff54ef3adc 0x7fff54ef3ad8!
We are actually here 0x562824b3f740 0x562824b3f740 (nil)!
[1]    49972 segmentation fault (core dumped)  cinnamon-control-center -v display

Were "We are actually here" was printed in cc_display_monitor_get_preferred_mode_dbus.

Steps to reproduce

Expected behaviour

No segmentation fault and working display settings.

Other information

While xrandr reports the AOC monitor as primary, cinnamon puts the taskbar on the Dell. When trying to maximize a window on the AOC, it's move to the other screen. Placing unmaximized windows there works.

WolleTD commented 2 years ago

Ok, it's a little more complicated (isn't it always?). I got around hacking into the code and apparently, the monitor is missing the is-preferred property entirely and is-current only when 1920x1080@144 is selected – which it was.

So after I plugged something like here into get_scaled_geometry, I was able to open the display panel, but when I selected 144Hz, the configuration wasn't applied and the monitor shown as inactive again. After selecting 60Hz, I finally got my desktop back in a working state and 1920x1080@60 has is-current set. But still no is-preferred anywhere.

According to xrandr, both 60Hz and 144Hz are preferred, so probably it's the same issue for both properties. But if I'm correct, that issue isn't in this repository.

mtwebster commented 2 years ago

Hi, can you paste the output (preferably in a file) from the following commands:

gdbus call --session --dest org.cinnamon.Muffin.DisplayConfig --object-path /org/cinnamon/Muffin/DisplayConfig --method org.cinnamon.Muffin.DisplayConfig.GetCurrentState

and

gdbus call --session --dest org.cinnamon.Muffin.DisplayConfig --object-path /org/cinnamon/Muffin/DisplayConfig --method org.cinnamon.Muffin.DisplayConfig.GetResources

Maybe I can match what's missing to where this data is being gathered in muffin.

WolleTD commented 2 years ago

current-state.txt resources.txt