# HG changeset patch # User Chris Cannam # Date 1476193032 -3600 # Node ID 00221fb5b9d2ce1f945321d309f5e1e87a812524 # Parent 19e47ffed5252f576f35622c6749a7e8a3bdd4bf Ensure finish() can be called even if not configured (otherwise there's no way to dispose of the plugin) diff -r 19e47ffed525 -r 00221fb5b9d2 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);