From 98ddc0df71f1659b943deff911dafe8d8acb0a8f Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 8 Sep 2008 10:16:45 +0000 Subject: [PATCH] improved destruction git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1588 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 3 +++ src/core/remote_plugin.cpp | 24 +++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf966461c..539b2e78c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2008-09-08 Tobias Doerffel + * src/core/remote_plugin.cpp: + improved destruction + * src/core/mixer.cpp: re-enabled WinMM MIDI diff --git a/src/core/remote_plugin.cpp b/src/core/remote_plugin.cpp index e84ad8c44..376697a86 100644 --- a/src/core/remote_plugin.cpp +++ b/src/core/remote_plugin.cpp @@ -82,13 +82,18 @@ remotePlugin::~remotePlugin() { if( m_failed == false ) { - sendMessage( IdQuit ); - - m_process.waitForFinished( 1000 ); - if( m_process.state() != QProcess::NotRunning ) + if( m_process.state() == QProcess::Running ) { - m_process.terminate(); - m_process.kill(); + lock(); + sendMessage( IdQuit ); + + m_process.waitForFinished( 1000 ); + if( m_process.state() != QProcess::NotRunning ) + { + m_process.terminate(); + m_process.kill(); + } + unlock(); } #ifdef USE_NATIVE_SHMEM @@ -105,6 +110,10 @@ remotePlugin::~remotePlugin() bool remotePlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf, bool _wait ) { + if( m_failed ) + { + return false; + } const fpp_t frames = engine::getMixer()->framesPerPeriod(); if( m_shm == NULL ) @@ -179,7 +188,8 @@ bool remotePlugin::process( const sampleFrame * _in_buf, bool remotePlugin::waitForProcessingFinished( sampleFrame * _out_buf ) { - if( !m_initialized || _out_buf == NULL || m_outputCount == 0 ) + if( m_failed || !m_initialized || _out_buf == NULL || + m_outputCount == 0 ) { return( false ); }