fix(plugins): stabilize VST3 and AU editor lifecycle, thread affinity, and scanning - #37
Merged
Merged
Conversation
… VST3 editor sizing
Horuse
force-pushed
the
fix/vst3-editor-lifecycle-and-stability
branch
from
September 5, 2026 17:34
d56bb4a to
31e5801
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes crashes, black/blank screens, and lifecycle issues when scanning, opening, and interacting with VST3 and AU plugin GUI editors (notably JUCE and complex UI plugins like Tokyo Dawn Labs TDR Nova and Native Instruments Replika):
open_plugin_editor,close_plugin_editor,get_plugin_state,plugin_status,get_plugin_params), bundle scanning, and host activations (Vst3Host::activate,AuHost::activate) strictly on the Main Thread. This prevents Tokio and audio engine background threads from triggering data races or AppKit/COM violations when initializing plugins (fixes startup crashes with AU plugins like Native Instruments Replika and scanner crashes on background threads).getSizelifecycle): EnsuresIPlugView::setFrameis called before sizing and queriesgetSize()both before and afterattached(), since many plugins (e.g. Native Instruments) only report layout dimensions after native window attachment. Additionally inspects the attached native subview frame on macOS and provides a fallback size (800x600) rather than failing witheditor reported no size.w.hide()/w.show()) instead of destroying and recreating theIPlugViewCOM object each time. This prevents COM teardown churn and heap corruption in plugins that rely on persistent static UI state.setWantsLayer: trueon the parent view, cleans up stale subviews, and notifies the view viaonFocus(1)andsetNeedsDisplay. Removes artificial coordinate insetting that previously corrupted the OpenGL/Metal viewport.has_editor: Caches the editor check inVst3Instanceto avoid repeatedcreateView(kEditor)calls during periodic status polling.Fixes #34
Fixes #35
Why is this the right approach?
IPlugViewdestruction, not by WebView2 or message loop collisions.cpal/SCKcallbacks orDspWorker::runremain completely wait-free and untouched).How was it tested?
editor reported no size.cargo test --lib(all 139 tests passed).main_thread::runusing thread ID validation) and standard OS window parenting, ready for testing on Windows by contributors with Windows machines.Checklist
refactors of code the change does not touch.
bun run checkpasses.cargo check --manifest-path src-tauri/Cargo.tomlpasses.bun run formatleaves the tree clean.#[derive(TS)]type, ranbun run generateandcommitted the regenerated files.