Unsubscribe from signals when clearing references

This fixes crashes with plugins calling setDirty() when the
UI is closed. `plugin` has already been reset before
the actual window is closed:

`PluginUIWindow::~PluginUIWindow()` runs, and destroys the window,
here `~VST3NSViewPluginUI ()`. This closes the VST3 view, which
triggers a `VST3PI::setDirty`.
At this point in time `~PlugUIBase()` has not yet run, so all
signals are still connected.

setDirty() ends up calling PlugUIBase::update_preset_modified()
which access `plugin` pointer, which is NULL.
This commit is contained in:
Robin Gareus 2021-03-01 22:11:15 +01:00
parent 291de1d277
commit e3c3109618
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 1 additions and 0 deletions

View File

@ -636,6 +636,7 @@ PlugUIBase::~PlugUIBase()
void
PlugUIBase::plugin_going_away ()
{
drop_connections ();
/* drop references to the plugin/insert */
insert.reset ();
plugin.reset ();