Skip to content

Log instead of assert in InstanceCounter destructor#84

Open
danielraffel wants to merge 1 commit into
VitalAudio:mainfrom
danielraffel:fix/instance-counter-no-crash-on-exit
Open

Log instead of assert in InstanceCounter destructor#84
danielraffel wants to merge 1 commit into
VitalAudio:mainfrom
danielraffel:fix/instance-counter-no-crash-on-exit

Conversation

@danielraffel

Copy link
Copy Markdown
Contributor

When a host application calls exit(), static destructors run before plugin editors have been cleaned up. The InstanceCounter singleton destructor sees a non-zero count and hits VISAGE_ASSERT, crashing the host during shutdown.

This isn't a real leak — the host just didn't give the plugin a chance to destroy its UI before tearing down the process. This replaces the assertion with VISAGE_LOG so it's still visible during debugging but doesn't crash the host.

We've seen this in practice with Ableton Live, which calls exit() on quit rather than cleanly destroying plugin editors first.


Discovered while working on a macOS JUCE audio plugin that uses Visage for its UI. This PR was put together with the help of Claude. Completely understand if you'd prefer to close this — just wanted to share the fix since we've been patching around it on our end whenever we update Visage.

When a host application calls exit(), static destructors run before
plugin editors have been cleaned up. The InstanceCounter singleton
destructor sees a non-zero count and hits VISAGE_ASSERT, crashing the
host during shutdown.

This isn't a real leak — the host just didn't give the plugin a
chance to destroy its UI before tearing down the process. Replace the
assertion with a VISAGE_LOG so it's still visible during debugging
but doesn't crash the host.
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