From ebfa897cb35cb6e910a8336b4d0912db15e10a48 Mon Sep 17 00:00:00 2001 From: Daniel Grasso Date: Sat, 13 Jun 2026 16:47:42 +0200 Subject: [PATCH] Defer the panel-button toggle out of the press gesture (shell crash, GNOME 48+) Clicking the panel button can abort the whole shell: Clutter:ERROR clutter-gesture.c:544 set_state: assertion failed: (new_state == CLUTTER_GESTURE_STATE_POSSIBLE) clutter_press_gesture_point_began <- clutter_gesture_handle_event The 'button-press-event' handler calls _toggle_search_light() -> show() synchronously while the Clutter press gesture is still in flight. show() reparents the entry/search actors and grabs key focus; mutating the actor tree mid-gesture corrupts the gesture state machine, and the next gesture point event asserts -> SIGABRT. On Wayland this ends the whole session. Defer the toggle with GLib.idle_add so the gesture completes before any actor surgery runs (imperceptible, one idle tick). Sibling of #164, which fixes the same class of crash on the app-launch (_release_ui) path. Tested on GNOME 50 / Fedora 44: before, clicking the panel button reliably SIGABRTs gnome-shell (coredump-confirmed); after, it opens normally. Likely the same root cause as #82 and #133. --- extension.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/extension.js b/extension.js index 81d5e0f..c24e31e 100644 --- a/extension.js +++ b/extension.js @@ -281,7 +281,20 @@ export default class SearchLightExt extends Extension { this._indicator.set_child(icon); this._indicator.connectObject( 'button-press-event', - this._toggle_search_light.bind(this), + () => { + // Defer the toggle out of the press gesture's handler: show() + // reparents the entry/search actors and grabs key focus, and doing + // that synchronously while the Clutter press gesture is in flight + // corrupts its state machine on GNOME 48+ (Clutter 18), aborting the + // shell with clutter-gesture.c:set_state assertion (new_state == + // CLUTTER_GESTURE_STATE_POSSIBLE). idle_add lets the gesture finish + // first (imperceptible, one tick). + GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => { + this._toggle_search_light(); + return GLib.SOURCE_REMOVE; + }); + return Clutter.EVENT_STOP; + }, this, ); try {