diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index 1c0c66c6e..5c7f807c9 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -418,6 +418,15 @@ RemoteVstPlugin::RemoteVstPlugin( key_t _shm_in, key_t _shm_out ) : RemoteVstPlugin::~RemoteVstPlugin() { + if( m_window != NULL ) + { + pluginDispatch( effEditClose ); +#ifdef LMMS_BUILD_LINUX + CloseWindow( m_window ); +#endif + m_window = NULL; + } + pluginDispatch( effMainsChanged, 0, 0 ); #ifndef USE_QT_SHMEM // detach shared memory segment if( shmdt( m_vstSyncData ) == -1) @@ -433,14 +442,6 @@ RemoteVstPlugin::~RemoteVstPlugin() } } #endif - if( m_window != NULL ) - { - pluginDispatch( effEditClose ); -#ifdef LMMS_BUILD_LINUX - CloseWindow( m_window ); -#endif - m_window = NULL; - } if( m_libInst != NULL ) { @@ -738,8 +739,6 @@ bool RemoteVstPlugin::load( const std::string & _plugin_file ) return false; } - m_plugin->user = this; - if( m_plugin->magic != kEffectMagic ) { debugMessage( "File is not a VST plugin\n" );