Skip to content

Conversation

@dfl
Copy link

@dfl dfl commented Jan 12, 2026

Summary

Problem

When closing the standalone app via the GUI (Cmd+Q or clicking X on macOS), there was a race condition where:

  1. Window::open_blocking() returns and the WrapperWindowHandler is dropped
  2. This drops _editor_handle, starting editor cleanup
  3. Only AFTER that do we signal the audio thread to stop
  4. The audio thread may still be accessing shared resources during cleanup, causing the crash

Solution

Handle WindowEvent::WillClose in WrapperWindowHandler::on_event to:

  1. Signal the audio thread to terminate
  2. Wait for the audio thread to finish (with 5s timeout)
  3. Then allow the window to close and the editor to be dropped

Also updates baseview from rev 579130ec to 237d323c which fixes a separate macOS crash during window initialization with newer Rust versions (1.86+).

Test plan

  • Build standalone plugin with GUI (e.g., gain_gui_vizia)
  • Run the standalone and verify window opens
  • Close via window X button - should exit cleanly
  • Verify no "foreign exceptions" crash

🤖 Generated with Claude Code

dfl and others added 2 commits January 12, 2026 16:56
When closing the standalone app via the GUI (Cmd+Q or clicking X on
macOS), there was a race condition where the editor would start
cleaning up while the audio thread was still processing, causing
crashes with "Rust cannot catch foreign exceptions" errors.

The fix handles WindowEvent::WillClose to signal the audio thread to
stop and wait for it to finish before allowing the window to close
and the editor to be dropped.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Updates baseview from rev 579130ec to 237d323c which includes PR robbert-vdh#204
"avoid crash when window is null in become_first_responder". This
fixes a crash during window initialization on macOS with newer Rust
versions (1.86+) where become_first_responder was called before the
view was fully attached to its window.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.

1 participant