Fix VST plugin window crash on macOS when closing#32745
Merged
igorkorsukov merged 1 commit intomusescore:masterfrom Mar 24, 2026
Merged
Fix VST plugin window crash on macOS when closing#32745igorkorsukov merged 1 commit intomusescore:masterfrom
igorkorsukov merged 1 commit intomusescore:masterfrom
Conversation
Fixes musescore#32742 The crash occurred when closing VST plugin windows (e.g., ARIA) on macOS. The issue was that IPlugView::removed() was being called during window closure, which tries to access NSView objects that macOS may already be deallocating as part of its own cleanup sequence. On macOS, the Cocoa framework handles NSView cleanup automatically during window destruction. Calling removed() at this point causes a crash because it attempts to interact with partially or fully deallocated NSView objects. On Windows and Linux, the underlying window handles (HWND/X11) remain valid throughout the close event, so calling removed() is safe and necessary for proper plugin cleanup. The fix skips the removed() call on macOS using #ifndef Q_OS_MAC, allowing the system to handle NSView cleanup naturally while maintaining proper cleanup on other platforms. This bug was introduced in commit d50a9bd (Dec 2022) when deinit() was added to closeEvent() to fix issue musescore#13867.
igorkorsukov
approved these changes
Mar 24, 2026
Contributor
|
Seems needed for 4.7 too, right?? |
Contributor
We need to test it first. I'll port it myself later |
Contributor
Author
2026-04-06.16-47-04.mp4Tested on MacOS Sequoia in a x86 VM, using latest nightly and latest version of ARIA player |
Merged
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.
Problem
MuseScore crashes when closing VST plugin windows (e.g., ARIA player) on macOS. The crash occurs with a segmentation fault during the window close sequence.
Platform: macOS only
Root Cause
The crash is caused by calling
IPlugView::removed()during thecloseEvent()on macOS. When the window closes, macOS's Cocoa framework may already be deallocating the NSView as part of its own cleanup sequence. Callingremoved()at this point attempts to interact with partially or fully deallocated NSView objects, resulting in a crash.This is a platform-specific issue:
closeEvent()is triggered, makingremoved()unsafeSolution
Skip calling
IPlugView::removed()on macOS using#ifndef Q_OS_MAC. The NSView cleanup is handled automatically by the Cocoa framework during window destruction, so the explicitremoved()call is unnecessary and harmful on macOS.On Windows and Linux,
removed()continues to be called to ensure proper plugin cleanup.Changes
Modified two files:
src/framework/vst/widgets/vstviewdialog_qwidget.cpp- QWidget-based VST dialogsrc/framework/vst/qml/Muse/Vst/vstview.cpp- QML-based VST viewBoth
deinit()methods now conditionally skipm_view->removed()on macOS.Testing
Resolves: #32742