Public bug reported:

On Ubuntu 26.04, the Displays panel of gnome-control-center crashes when
the laptop lid is closed and no external monitor is connected.

Environment:
- Ubuntu 26.04
- Official gnome-control-center package: 1:50.3-0ubuntu0.2
- gnome-control-center-data: 1:50.3-0ubuntu0.2
- GNOME Wayland session
- Laptop with a built-in display and no external monitor

Steps to reproduce:
1. Keep the GNOME session running with the laptop lid closed.
2. With no external monitor connected, run:
   gnome-control-center display

Actual result:
gnome-control-center terminates with SIGSEGV. The backtrace shows 
cc_display_monitor_set_active() at frame #0, with GTK switch notifications in 
the call chain.

Expected result:
The settings application should remain open, even if there is no display 
available for configuration. I understand that a closed built-in display may be 
excluded from configuration; this report concerns the crash in that state.

Investigation and local fix:
In panels/display/cc-display-settings.c, on_enabled_row_active_changed_cb() 
only checks self->updating before passing self->selected_output to 
cc_display_monitor_set_active().

I applied the following patch:

```diff
--- a/panels/display/cc-display-settings.c
+++ b/panels/display/cc-display-settings.c
@@ -686,7 +686,7 @@
 on_enabled_row_active_changed_cb (CcDisplaySettings *self)
 {
-  if (self->updating)
+  if (self->updating || self->selected_output == NULL)
     return;
 
   cc_display_monitor_set_active (self->selected_output,
                                  adw_switch_row_get_active 
(self->enabled_row));
```

Verification:
I rebuilt the Ubuntu source package and installed gnome-control-center and 
gnome-control-center-data as 1:50.3-0ubuntu0.2+local1. After applying this 
patch, the Displays panel no longer crashes with the laptop lid closed.

The attached backtrace was collected from the unmodified official
package, 1:50.3-0ubuntu0.2, before installing the local fix.

Previous occurrence:
I previously encountered a similar crash on Ubuntu 24.04 with package 
1:46.7-0ubuntu0.24.04.6 in an X11 session. In that investigation, the backtrace 
showed cc_display_monitor_set_active(self=0x0), and the same NULL guard 
prevented the crash.

The Ubuntu 26.04 backtrace does not show argument values, so a NULL
dereference in this version is inferred from the previous investigation,
the source code, and the successful local fix.

Related upstream report:
https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2077

I have not tested upstream main and cannot confirm whether this has
exactly the same cause as the original upstream report.

** Affects: gnome-control-center (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Official package crash backtrace"
   
https://bugs.launchpad.net/bugs/2169467/+attachment/6005499/+files/gnome-control-center-50.3-backtrace.txt

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2169467

Title:
  gnome-control-center Displays panel crashes with laptop lid closed and
  no external monitor; NULL guard fixes crash

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/2169467/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to