Mercurial > hg > piper-cpp
comparison vamp-server/server.cpp @ 77:ac1e4634479b
Ensure finish() can be called even if not configured (otherwise there's no way to dispose of the plugin)
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Tue, 11 Oct 2016 14:36:43 +0100 |
parents | 81e1c48e97f9 |
children | 03ed2e0a6c8f |
comparison
equal
deleted
inserted
replaced
76:5909d5d25733 | 77:ac1e4634479b |
---|---|
228 break; | 228 break; |
229 } | 229 } |
230 | 230 |
231 case RRType::Finish: | 231 case RRType::Finish: |
232 { | 232 { |
233 response.finishResponse.plugin = request.finishRequest.plugin; | 233 auto &freq = request.finishRequest; |
234 response.finishResponse.features = | 234 response.finishResponse.plugin = freq.plugin; |
235 request.finishRequest.plugin->getRemainingFeatures(); | 235 |
236 auto h = mapper.pluginToHandle(freq.plugin); | |
237 // Finish can be called (to unload the plugin) even if the | |
238 // plugin has never been configured or used. But we want to | |
239 // make sure we call getRemainingFeatures only if we have | |
240 // actually configured the plugin. | |
241 if (mapper.isConfigured(h)) { | |
242 response.finishResponse.features = freq.plugin->getRemainingFeatures(); | |
243 } | |
236 | 244 |
237 // We do not delete the plugin here -- we need it in the | 245 // We do not delete the plugin here -- we need it in the |
238 // mapper when converting the features. It gets deleted by the | 246 // mapper when converting the features. It gets deleted in the |
239 // caller. | 247 // calling function. |
240 | |
241 response.success = true; | 248 response.success = true; |
242 break; | 249 break; |
243 } | 250 } |
244 | 251 |
245 case RRType::NotValid: | 252 case RRType::NotValid: |