From 541d9d5ad6b557597068c0839b5734ecbba98084 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Fri, 19 Dec 2008 16:22:10 +0000 Subject: [PATCH] fixed crash when adding VST effects git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1962 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 15 +++++++++++++++ plugins/vestige/vestige.cpp | 4 ++++ plugins/vst_base/vst_plugin.cpp | 1 - plugins/vst_base/vst_plugin.h | 4 ++-- plugins/vst_effect/vst_effect.cpp | 6 +++--- plugins/vst_effect/vst_effect_control_dialog.cpp | 6 +++++- 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c49cf84b..d58a9a661 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-12-19 Tobias Doerffel + + * plugins/vst_base/vst_plugin.h: + * plugins/vst_base/vst_plugin.cpp: + * plugins/vst_effect/vst_effect_control_dialog.cpp: + * plugins/vst_effect/vst_effect.cpp: + * plugins/vestige/vestige.cpp: + fixed crash when adding VST effects + + * include/project_version.h: + * src/core/project_version.cpp: + fixed broken version comparing which indicated 0.x.y to be less than + 0.x.y-patch - fixes messed up projects when loading files created + with LMMS 0.4.0 + 2008-12-17 Tobias Doerffel * CMakeLists.txt: diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index ebeaef2c4..5292284be 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -222,6 +222,10 @@ bool vestigeInstrument::handleMidiEvent( const midiEvent & _me, void vestigeInstrument::closePlugin( void ) { m_pluginMutex.lock(); + if( m_plugin ) + { + delete m_plugin->pluginWidget(); + } delete m_plugin; m_plugin = NULL; m_pluginMutex.unlock(); diff --git a/plugins/vst_base/vst_plugin.cpp b/plugins/vst_base/vst_plugin.cpp index 4a0c57117..8b95e3b77 100644 --- a/plugins/vst_base/vst_plugin.cpp +++ b/plugins/vst_base/vst_plugin.cpp @@ -159,7 +159,6 @@ vstPlugin::vstPlugin( const QString & _plugin ) : vstPlugin::~vstPlugin() { - delete pluginWidget(); } diff --git a/plugins/vst_base/vst_plugin.h b/plugins/vst_base/vst_plugin.h index bd8061b17..d41a33a9c 100644 --- a/plugins/vst_base/vst_plugin.h +++ b/plugins/vst_base/vst_plugin.h @@ -74,9 +74,9 @@ public: void setParameterDump( const QMap & _pdump ); - inline QWidget * pluginWidget( void ) + inline QWidget * pluginWidget( bool _top_widget = true ) { - if( m_pluginWidget ) + if( _top_widget && m_pluginWidget ) { if( m_pluginWidget->parentWidget() ) { diff --git a/plugins/vst_effect/vst_effect.cpp b/plugins/vst_effect/vst_effect.cpp index efe5e7c31..8903b202f 100644 --- a/plugins/vst_effect/vst_effect.cpp +++ b/plugins/vst_effect/vst_effect.cpp @@ -86,7 +86,7 @@ bool vstEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames ) { if( !isEnabled() || !isRunning () ) { - return( FALSE ); + return false; } if( m_plugin ) @@ -180,9 +180,9 @@ extern "C" // neccessary for getting instance out of shared lib plugin * lmms_plugin_main( model * _parent, void * _data ) { - return( new vstEffect( _parent, + return new vstEffect( _parent, static_cast( - _data ) ) ); + _data ) ); } } diff --git a/plugins/vst_effect/vst_effect_control_dialog.cpp b/plugins/vst_effect/vst_effect_control_dialog.cpp index 59037b595..1d0b0b7b5 100644 --- a/plugins/vst_effect/vst_effect_control_dialog.cpp +++ b/plugins/vst_effect/vst_effect_control_dialog.cpp @@ -35,10 +35,14 @@ vstEffectControlDialog::vstEffectControlDialog( vstEffectControls * _ctl ) : effectControlDialog( _ctl ) { QVBoxLayout * l = new QVBoxLayout( this ); + l->setMargin( 0 ); + l->setSpacing( 0 ); + _ctl->m_effect->m_plugin->showEditor( this ); - QWidget * w = _ctl->m_effect->m_plugin->pluginWidget(); + QWidget * w = _ctl->m_effect->m_plugin->pluginWidget( false ); if( w ) { + setWindowTitle( w->windowTitle() ); l->addWidget( w ); } }