fix(tauri): prevent View menu zoom deadlock#594
Conversation
Release the zoom-level mutex before applying a WebView zoom change. The View menu previously held the non-reentrant mutex while set_main_window_zoom attempted to acquire it again, freezing the Tauri event loop on both macOS and Windows. Route zoom-in and zoom-out through a shared read/apply boundary and add a regression test that verifies the mutex can be acquired from inside the apply callback. Validated with all 21 Tauri Rust tests and an independent gatekeeper review. Clippy still reports only existing warnings outside this change.
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/29326844780 Artifacts expire in 7 days.
|
There was a problem hiding this comment.
PASS on c0db4bd.
The change removes the zoom-menu deadlock by calculating the next level while the mutex is held, then invoking set_main_window_zoom only after the guard has been dropped. The regression test directly confirms that the apply callback can reacquire the same mutex.
Validation: cargo test passed (21/21), git diff --check passed, and the full Electron/Tauri CI matrix is green.
I am the PR author, so GitHub does not permit a formal approval; this comment records the gatekeeper verdict without claiming an independent approval.
|
@shantur LGTM |
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/29330965921 Artifacts expire in 7 days.
|
Summary
Root cause
The View menu handler held the non-reentrant
zoom_levelmutex while callingset_main_window_zoom(). After the WebView accepted the zoom change, that function attempted to lockzoom_levelagain to persist the normalized value, deadlocking the Tauri event-loop thread.Keyboard and mouse-wheel zoom paths do not use this menu handler, which is why the freeze was specific to menu actions on macOS and Windows.
Validation
cargo test --manifest-path packages/tauri-app/src-tauri/Cargo.toml: 21 passedgit diff --check: passedCloses #537
Closes #591