VST2 plugin not getting "close plugin opcode" (opcode 1)

Official support for: mutools.com
Post Reply New Topic
RELATED
PRODUCTS
MuLab App

Post

Hi,

I think VST2 plugins are supposed to get opcode 1 (close plugin) as a last thing, to advice them to free all its memory, yet I don't seem to be getting them. This leads to certain aspects of my plugin leaking memory & resources (e.g. I'm running some separate GUI and background threads).

Replicating the bug is easy: add a VST2 plugin to a rack and then delete it while debugging & having breakpoints to watch what opcodes are coming; opcode 1 doesn't seem to ever arrive (?).

P.S. "but VST2 is deprecated" -> VST2 is currently the only plugin format for which there is Golang libraries. We've been toying with the idea of writing Golang bindings for CLAP, but it's a decent sized mountain to climb and won't happen anytime soon. And VST3 is not a realistic option, it is even bigger mountain to bind it to a language not named C++.

Post

Just FYI but there does seem to be a C API for VST3.

https://github.com/steinbergmedia/vst3_c_api

But CLAP should still be easier to bind to.

Post

I know all this. But that VST3 "C api" is header file with 3497 lines of definitions, with no accompanying documentation, and all documentation and tutorials assume you're writing C++. Hard pass. Also, still salty for the dick move Steinberg did with VST2 deprecation. I have no profit to make from this hobby project, so I will never touch VST3 in any form, just out of principle.

Post

That's all fair enough. :)

Post

pestis wrote: Wed Apr 30, 2025 8:00 am Replicating the bug is easy: add a VST2 plugin to a rack and then delete it while debugging & having breakpoints to watch what opcodes are coming; opcode 1 doesn't seem to ever arrive (?).
That's not a bug. When the user deletes a module / plugin, it is removed from the project, but it's kept alive in the undo-redo system. When you want to test the effective deletion case of your plugin then remove it from a rack followed by Project menu -> Clear Undo-Redo History.
If you need to do this often, you can assign a shortcut key to Clear Undo-Redo History.

Post

Thanks, this is correct. After running Clear Undo-Redo History, the plugin unloads like it should. Closing.

Post Reply

Return to “MuTools”