# HG changeset patch # User Chris Cannam # Date 1485861967 0 # Node ID f13dc1db2229a6bbb822724be6e1c7e9d3b1fcc5 # Parent 4a37daf5f8b48b92069d0453e8bafcd23cf5bcd3 Trap and rethrow after locking into failed state diff -r 4a37daf5f8b4 -r f13dc1db2229 vamp-client/PluginStub.h --- a/vamp-client/PluginStub.h Tue Jan 31 11:08:31 2017 +0000 +++ b/vamp-client/PluginStub.h Tue Jan 31 11:26:07 2017 +0000 @@ -166,7 +166,12 @@ m_config.stepSize = int(stepSize); m_config.blockSize = int(blockSize); - m_outputs = m_client->configure(this, m_config); + try { + m_outputs = m_client->configure(this, m_config); + } catch (const std::exception &e) { + m_state = Failed; + throw; + } if (!m_outputs.empty()) { m_state = Configured; @@ -185,8 +190,13 @@ // reset is a no-op if the plugin hasn't been initialised yet return; } - - m_client->reset(this, m_config); + + try { + m_client->reset(this, m_config); + } catch (const std::exception &e) { + m_state = Failed; + throw; + } m_state = Configured; } @@ -258,8 +268,13 @@ (inputBuffers[c], inputBuffers[c] + m_config.blockSize)); } - - return m_client->process(this, vecbuf, timestamp); + + try { + return m_client->process(this, vecbuf, timestamp); + } catch (const std::exception &e) { + m_state = Failed; + throw; + } } virtual FeatureSet getRemainingFeatures() { @@ -278,7 +293,12 @@ m_state = Finished; - return m_client->finish(this); + try { + return m_client->finish(this); + } catch (const std::exception &e) { + m_state = Failed; + throw; + } } // Not Plugin methods, but needed by the PluginClient to support reloads: