| 142 | } |
| 143 | |
| 144 | bool PluginManager::UnloadPlugin(const QString& name) |
| 145 | { |
| 146 | for (int i = 0; i < m_entries.size(); ++i) |
| 147 | { |
| 148 | if (QString::fromStdString(m_entries[i].plugin->Name()) == name) |
| 149 | { |
| 150 | qDebug() << "PluginManager: Unloading plugin:" << name; |
| 151 | |
| 152 | IPlugin* plugin = m_entries[i].plugin; |
| 153 | |
| 154 | // Unregister provider from global registry |
| 155 | if (plugin->Type() == IPlugin::ProviderPlugin) |
| 156 | { |
| 157 | QString identifier = name.toLower().replace(" ", ""); |
| 158 | ProviderRegistry::instance().unregisterProvider(identifier); |
| 159 | } |
| 160 | |
| 161 | // Delete plugin instance |
| 162 | delete plugin; |
| 163 | |
| 164 | // Unload library |
| 165 | m_entries[i].library->unload(); |
| 166 | delete m_entries[i].library; |
| 167 | |
| 168 | // Remove from lists |
| 169 | m_entries.remove(i); |
| 170 | m_plugins.remove(i); |
| 171 | |
| 172 | return true; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | qWarning() << "PluginManager: Plugin not found:" << name; |
| 177 | return false; |
| 178 | } |
| 179 | |
| 180 | void PluginManager::UnloadPlugins() |
| 181 | { |
no test coverage detected