Beispiel #1
0
void ModuleRegistry::UnRegister(const ModuleInfo* info)
{
  // If we are unregistering the core module, we just call
  // the module activators Unload() method (if there is a
  // module activator). Since we cannot be sure that the
  // ModuleContext for the core library is still valid, we
  // just pass a null-pointer. Using the module context during
  // static deinitalization time of the core library makes
  // no sense anyway.
  if (info->id == 1)
  {
    // Remove listeners from static modules if they have forgotten to do so
    coreModuleContext()->listeners.RemoveAllListeners(GetModuleContext());

    if (info->activatorHook)
    {
      info->activatorHook()->Unload(0);
    }
    return;
  }

  Module* curr = 0;
  {
    MutexLock lock(*modulesLock());
    curr = modules()->operator[](info->id);
    assert(curr != 0);
  }

  curr->Stop();
}
Beispiel #2
0
void ModuleRegistry::UnRegister(const ModuleInfo* info)
{
  // If we are unregistering the Mitk module, we just call
  // the module activators Unload() method (if there is a
  // module activator). Since we cannot be sure that the
  // ModuleContext for the Mitk library is still valid, we
  // just pass a null-pointer. Using the module context during
  // static deinitalization time of the Mitk library makes
  // no sense anyway.
  if (info->id == 1 && info->activatorHook)
  {
    info->activatorHook()->Unload(0);
    return;
  }

  Module* curr = 0;
  {
    MutexLocker lock(*modulesLock());
    curr = modules()->operator[](info->id);
    assert(curr != 0);
  }
  curr->Stop();
  curr->Uninit();
}