MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / unload

Method unload

Suscan/Plugin.cpp:285–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285bool
286Plugin::unload(void)
287{
288 if (this->m_loaded) {
289 if (!this->canBeUnloaded()) {
290 SU_ERROR(
291 "%s: plugin cannot be loaded (plugin in use)\n",
292 this->m_path.c_str());
293 return false;
294 }
295
296 auto p = this->m_factorySet.begin();
297
298 // Erase and unregister all factories globally
299 while (p != this->m_factorySet.end()) {
300 FeatureFactory *ref = *p;
301 if (!ref->unregisterGlobally()) {
302 SU_ERROR(
303 "%s: plugin cannot be loaded (failed to unregister global references to %s)\n",
304 this->m_path.c_str(),
305 ref->name());
306 return false;
307 }
308
309 // Erase and get next. It is important to do this before deleting
310 // the object.
311 p = this->m_factorySet.erase(p);
312
313 delete ref;
314 }
315
316 this->m_loaded = false;
317 }
318
319 return true;
320}
321
322bool
323Plugin::registerFactory(FeatureFactory *factory)

Callers 1

loadMethod · 0.95

Calls 5

canBeUnloadedMethod · 0.95
beginMethod · 0.45
endMethod · 0.45
unregisterGloballyMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected