| 99 | } |
| 100 | |
| 101 | void ModulePrivate::RemoveModuleResources() |
| 102 | { |
| 103 | coreCtx->listeners.RemoveAllListeners(moduleContext); |
| 104 | |
| 105 | std::vector<ServiceRegistrationBase> srs; |
| 106 | coreCtx->services.GetRegisteredByModule(this, srs); |
| 107 | for (std::vector<ServiceRegistrationBase>::iterator i = srs.begin(); |
| 108 | i != srs.end(); ++i) |
| 109 | { |
| 110 | try |
| 111 | { |
| 112 | i->Unregister(); |
| 113 | } |
| 114 | catch (const std::logic_error& /*ignore*/) |
| 115 | { |
| 116 | // Someone has unregistered the service after stop completed. |
| 117 | // This should not occur, but we don't want get stuck in |
| 118 | // an illegal state so we catch it. |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | srs.clear(); |
| 123 | coreCtx->services.GetUsedByModule(q, srs); |
| 124 | for (std::vector<ServiceRegistrationBase>::const_iterator i = srs.begin(); |
| 125 | i != srs.end(); ++i) |
| 126 | { |
| 127 | i->GetReference(std::string()).d->UngetService(q, false); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | } |
no test coverage detected