Public bug reported:

## Summary

gnome-shell 46.0 crashes with SIGTRAP when mutter's
`meta_window_destroy_frame()` calls `XReparentWindow` on a window being
destroyed. Because X11 delivers the resulting `BadWindow` error
asynchronously, it surfaces later at the next synchronous X call
(`XInternAtom` in `meta_x11_selection_handle_selection_request`), where
`mtk_x_error` → `g_error()` kills gnome-shell fatally.

The root cause is missing error traps around `XReparentWindow` calls in
`src/x11/meta-x11-frame.c`. These traps were added upstream in May 2024
— after the gnome-46 branch was created — and were never backported to
Ubuntu 24.04.

## Missing upstream commits

The following three commits on mutter main (all 2024-05-27) add the
required error traps:

- `b0df2d0f` — x11: Add error trap around XReparentWindow in 
meta_window_destroy_frame
- `e1dbf102` — x11: Add error trap around XReparentWindow in 
meta_window_create_frame  
- `2065214b` — x11: Related cleanup / consolidation

Confirmed by mutter developer @skeller 
(gitlab.gnome.org/GNOME/mutter/-/issues/4684#note_2713562):
> "On 50 and a few earlier versions all calls to XReparentWindow in mutter and 
> gnome-shell are surrounded by error traps. So this is probably Ubuntu missing 
> some fixes."

## Stack trace (mutter 46.2, Ubuntu 24.04, with debug symbols from
ddebs.ubuntu.com)

```
#0  g_log_structured_array (log_level=G_LOG_LEVEL_ERROR) at gmessages.c:426
#1  g_log_default_handler (log_domain="Mtk",
      message="Received an X Window System error.
      The error was 'BadWindow (invalid Window parameter)'.
      Details: serial 418053 error_code 3 request_code 7 (core protocol) 
minor_code 0")
#4  display_error_event (error=...) at mtk/mtk/mtk-x11-errors.c:116
#5  mtk_x_error () at mtk/mtk/mtk-x11-errors.c:139
#6  _XError () at libX11.so.6
#9  _XReply () at libX11.so.6
#10 XInternAtom () at libX11.so.6
#11 meta_x11_selection_handle_selection_request (xevent=..., x11_display=...)
      at src/x11/meta-x11-selection.c:238
#12 meta_x11_selection_handle_event () at src/x11/meta-x11-selection.c:450
#13 process_selection_event () at src/x11/events.c:1799
#14 meta_x11_display_handle_xevent () at src/x11/events.c:1878
#16 meta_x11_event_source_dispatch () at src/x11/meta-x11-event-source.c:62
#17 g_main_dispatch () at gmain.c:3344
#20 g_main_loop_run () at gmain.c:4419
#21 meta_context_run_main_loop () at src/core/meta-context.c:523
```

## Environment

- OS: Ubuntu 24.04 (Noble)
- gnome-shell: 46.0-0ubuntu6~24.04.13
- mutter: 46.2-1ubuntu0.24.04.14
- Kernel: 6.17.0-19-generic x86_64

## Upstream reference

gitlab.gnome.org/GNOME/mutter/-/issues/4684

## Fix

Backport commits b0df2d0f, e1dbf102, 2065214b to the Ubuntu 24.04 mutter
package.

** Affects: mutter (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: backport-request crash gnome-shell x11

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

Title:
  mutter 46.2 missing error trap fixes for XReparentWindow (BadWindow
  crash in gnome-shell)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2145049/+subscriptions


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

Reply via email to