comparison transform/FeatureExtractionModelTransformer.cpp @ 1830:5f8fbbde08ff audio-source-refactor

Use shared_ptr for plugin instances throughout
author Chris Cannam
date Fri, 20 Mar 2020 16:30:33 +0000
parents 4eac4bf35b45
children 1b688ab5f1b3
comparison
equal deleted inserted replaced
1829:51fd27fbce9a 1830:5f8fbbde08ff
264 { 264 {
265 SVDEBUG << "FeatureExtractionModelTransformer: deleting plugin for transform in thread " 265 SVDEBUG << "FeatureExtractionModelTransformer: deleting plugin for transform in thread "
266 << QThread::currentThreadId() << endl; 266 << QThread::currentThreadId() << endl;
267 267
268 try { 268 try {
269 delete m_plugin; 269 m_plugin = {}; // does not necessarily delete, as it's a
270 // shared_ptr, but in the design case it will
270 } catch (const std::exception &e) { 271 } catch (const std::exception &e) {
271 // A destructor shouldn't throw an exception. But at one point 272 // A destructor shouldn't throw an exception. But at one point
272 // (now fixed) our plugin stub destructor could have 273 // (now fixed) our plugin stub destructor could have
273 // accidentally done so, so just in case: 274 // accidentally done so, so just in case:
274 SVCERR << "FeatureExtractionModelTransformer: caught exception while deleting plugin: " << e.what() << endl; 275 SVCERR << "FeatureExtractionModelTransformer: caught exception while deleting plugin: " << e.what() << endl;
275 m_message = e.what(); 276 m_message = e.what();
276 } 277 }
277 m_plugin = nullptr;
278 278
279 m_descriptors.clear(); 279 m_descriptors.clear();
280 } 280 }
281 281
282 void 282 void