From 7b59a9f77be29bb3a94bddc5764ff843a140fd89 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 30 Jun 2008 21:45:45 +0000 Subject: [PATCH] fixed crash when an effect failed to load because its sub-plugin is missing (closes #2005910) git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1248 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/core/effect_chain.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/core/effect_chain.cpp b/src/core/effect_chain.cpp index e7335be7c..61cbdbda0 100644 --- a/src/core/effect_chain.cpp +++ b/src/core/effect_chain.cpp @@ -30,7 +30,7 @@ #include "effect.h" #include "engine.h" #include "debug.h" - +#include "dummy_effect.h" @@ -88,16 +88,22 @@ void effectChain::loadSettings( const QDomElement & _this ) // base64-data inside :-) effectKey key( cn.attribute( "key" ) ); effect * e = effect::instantiate( name, this, &key ); - m_effects.push_back( e ); - // TODO: somehow detect if effect is sub-plugin-capable - // but couldn't load sub-plugin with requested key - if( node.isElement() ) + if( e->isOkay() ) { - if( e->nodeName() == node.nodeName() ) + if( node.isElement() ) { - e->restoreState( node.toElement() ); + if( e->nodeName() == node.nodeName() ) + { + e->restoreState( node.toElement() ); + } } } + else + { + delete e; + e = new dummyEffect( parentModel() ); + } + m_effects.push_back( e ); ++fx_loaded; } node = node.nextSibling();