Skip to content

fix(tauri): prevent View menu zoom deadlock#594

Open
pascalandr wants to merge 2 commits into
NeuralNomadsAI:devfrom
pascalandr:fix/tauri-menu-zoom-deadlock
Open

fix(tauri): prevent View menu zoom deadlock#594
pascalandr wants to merge 2 commits into
NeuralNomadsAI:devfrom
pascalandr:fix/tauri-menu-zoom-deadlock

Conversation

@pascalandr

Copy link
Copy Markdown
Contributor

Summary

  • release the Tauri zoom-level mutex before applying WebView zoom changes
  • route View > Zoom In and View > Zoom Out through a shared lock-safe boundary
  • add a regression test that reacquires the mutex from inside the zoom apply callback

Root cause

The View menu handler held the non-reentrant zoom_level mutex while calling set_main_window_zoom(). After the WebView accepted the zoom change, that function attempted to lock zoom_level again 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 passed
  • git diff --check: passed
  • independent gatekeeper review: PASS
  • Clippy reports only pre-existing warnings outside this change

Closes #537
Closes #591

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.
@github-actions

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/29326844780

Artifacts expire in 7 days.
Artifacts:

  • pr-594-c0db4bdedbdbce0e22dd064db80609259d007370-tauri-macos
  • pr-594-c0db4bdedbdbce0e22dd064db80609259d007370-tauri-windows
  • pr-594-c0db4bdedbdbce0e22dd064db80609259d007370-electron-macos
  • pr-594-c0db4bdedbdbce0e22dd064db80609259d007370-tauri-linux
  • pr-594-c0db4bdedbdbce0e22dd064db80609259d007370-electron-linux
  • pr-594-c0db4bdedbdbce0e22dd064db80609259d007370-tauri-macos-arm64
  • pr-594-c0db4bdedbdbce0e22dd064db80609259d007370-electron-windows

@pascalandr pascalandr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pascalandr pascalandr requested a review from shantur July 14, 2026 12:03
@pascalandr

Copy link
Copy Markdown
Contributor Author

@shantur LGTM

@pascalandr pascalandr removed the request for review from shantur July 14, 2026 12:14
@github-actions

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/29330965921

Artifacts expire in 7 days.
Artifacts:

  • pr-594-777a5967788dc88d13c84e0569bf336e4f4d6989-electron-macos
  • pr-594-777a5967788dc88d13c84e0569bf336e4f4d6989-tauri-macos
  • pr-594-777a5967788dc88d13c84e0569bf336e4f4d6989-tauri-windows
  • pr-594-777a5967788dc88d13c84e0569bf336e4f4d6989-tauri-macos-arm64
  • pr-594-777a5967788dc88d13c84e0569bf336e4f4d6989-tauri-linux
  • pr-594-777a5967788dc88d13c84e0569bf336e4f4d6989-electron-linux
  • pr-594-777a5967788dc88d13c84e0569bf336e4f4d6989-electron-windows

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: View / Zoom In causes CodeNomad to hang (spinning wheel) [Bug]: zoom out -> crash

2 participants