# HG changeset patch # User Chris Cannam # Date 1476193032 -3600 # Node ID ae292da1cabe43490a3e3ad79afbc2a3d18de839 # Parent 90bf9d9f9c95fcdc16b49fac91eae698a655c6e0 Ensure finish() can be called even if not configured (otherwise there's no way to dispose of the plugin) diff -r 90bf9d9f9c95 -r ae292da1cabe PiperPluginLibrary.cpp --- a/PiperPluginLibrary.cpp Mon Oct 10 17:05:37 2016 +0100 +++ b/PiperPluginLibrary.cpp Tue Oct 11 14:37:12 2016 +0100 @@ -292,13 +292,18 @@ auto h = m_mapper.pluginToHandle(req.plugin); if (h == m_mapper.INVALID_HANDLE) { rj = VampJson::fromError("unknown or invalid plugin handle", type, id); - } else if (!m_mapper.isConfigured(h)) { - rj = VampJson::fromError("plugin has not been configured", type, id); } else { Vamp::HostExt::ProcessResponse resp; resp.plugin = req.plugin; - resp.features = req.plugin->getRemainingFeatures(); + + // Finish can be called (to unload the plugin) even if + // the plugin has never been configured or used. But + // we want to make sure we call getRemainingFeatures + // only if we have actually configured the plugin. + if (m_mapper.isConfigured(h)) { + resp.features = req.plugin->getRemainingFeatures(); + } rj = VampJson::fromRpcResponse_Finish (resp, m_mapper, serialisation, id);