Skip to content

fix(linux): startup crash — click-through toggle aborts on unrealized GTK window#906

Open
jboero wants to merge 1 commit into
jamiepine:mainfrom
jboero:fix/linux-startup-crash
Open

fix(linux): startup crash — click-through toggle aborts on unrealized GTK window#906
jboero wants to merge 1 commit into
jamiepine:mainfrom
jboero:fix/linux-startup-crash

Conversation

@jboero

@jboero jboero commented Jul 18, 2026

Copy link
Copy Markdown

Problem

On Linux, Voicebox aborts (SIGABRT) within seconds of launch, on both Wayland and X11:

thread 'main' panicked at tao-0.34.5/src/platform_impl/linux/event_loop.rs:449:18:
called `Option::unwrap()` on a `None` value
thread 'main' panicked at library/core/src/panicking.rs:225:5:
panic in a function that cannot unwind

Cause

The dictate pill window is built hidden at setup (.visible(false)), so GTK never realizes it — it has no underlying GdkWindow. As soon as the pill webview mounts, the frontend emits dictate:hide (DictateWindow.tsx enters the hidden state), and the Rust handler calls window.set_ignore_cursor_events(true). tao's WindowRequest::CursorIgnoreEvents path does window.window().unwrap() on the unrealized window → None → panic inside a glib dispatch that cannot unwind → process abort.

This affects every Linux user at startup; the realization behavior is identical on X11 and Wayland.

Fix

Gate the three set_ignore_cursor_events call sites behind #[cfg(not(target_os = "linux"))]. The click-through toggle exists as a macOS workaround (transparent always-on-top NSWindows lingering as invisible click targets — see the existing comments); on GTK, hide() unmaps the window and unmapped windows can't receive input, and the window is parked at (-10_000, -10_000) besides. Gating both the true and false calls keeps the state balanced: never set, never needs unsetting.

macOS and Windows compile byte-identical code to before — zero behavior change outside Linux.

Testing

  • Reproduced the abort on Fedora 44 (Wayland, GNOME) with 3 coredumps confirming the same stack.
  • With this patch the app launches, spawns the sidecar, serves /health, and runs through TTS generation without the abort.

A cleaner long-term fix would be tao handling unrealized windows gracefully in CursorIgnoreEvents instead of unwrapping; this PR is the pragmatic app-level fix.

🤖 Generated with Claude Code

Related issues

Fixes #873 (same crash, same diagnosis — set_ignore_cursor_events on the transparent dictate window, tao 0.34.5 event_loop.rs:449).
Fixes #680 (same panic at startup on Kubuntu 24.04 / X11 — confirms this is not Wayland-specific).
Likely also resolves #803 (same unwrap in tao 0.35.3 at its shifted line 457, reported as Wayland+NVIDIA — worth a retest with this patch rather than auto-closing).

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a Linux startup crash that could occur when opening the dictation window.
    • Improved dictation window show and hide behavior on Linux by avoiding an unsupported cursor-interaction setting during window initialization.

…tup crash

The dictate pill window is built hidden at setup and the frontend emits
dictate:hide as soon as it mounts. The handler calls
set_ignore_cursor_events(true) on a window GTK has never realized, and
tao's CursorIgnoreEvents path unwraps the missing GdkWindow
(tao-0.34.5 event_loop.rs:449), panicking inside a glib dispatch that
cannot unwind — the process aborts within seconds of launch on Linux.

The click-through toggle exists as a macOS workaround for transparent
always-on-top NSWindows lingering as invisible click targets; it was
never needed on Linux. Gate all three call sites so Linux never toggles
it: the true/false pair stays balanced (never set, never unset), and
macOS/Windows builds are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Linux builds now skip Tauri cursor-event configuration during dictate window startup, display, and hide handling. Non-Linux behavior remains unchanged.

Changes

Linux cursor-event guards

Layer / File(s) Summary
Guard dictate window cursor configuration
tauri/src-tauri/src/hotkey_monitor.rs, tauri/src-tauri/src/main.rs
set_ignore_cursor_events calls are conditionally compiled out on Linux across recording startup, window display, and dictate:hide handling.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: jamiepine

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the Linux crash fix and the click-through toggle guard on unrealized GTK windows.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jboero

jboero commented Jul 18, 2026

Copy link
Copy Markdown
Author

Sorry is docstring coverage really a hard stop for a segfault fix?

@jboero

jboero commented Jul 18, 2026

Copy link
Copy Markdown
Author

Thank you CodeRabbit 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant