Mercurial > hg > vamp-plugin-sdk
changeset 524:762b79b49c31 c++11-mutex
Don't even ask to unload library if another plugin is loaded from it
author | Chris Cannam |
---|---|
date | Mon, 09 Sep 2019 10:23:37 +0100 |
parents | e0ff22b3c888 |
children | 8c18bdaad04f |
files | src/vamp-hostsdk/PluginLoader.cpp |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/vamp-hostsdk/PluginLoader.cpp Fri Aug 16 10:18:37 2019 +0100 +++ b/src/vamp-hostsdk/PluginLoader.cpp Mon Sep 09 10:23:37 2019 +0100 @@ -567,8 +567,18 @@ PluginLoader::Impl::pluginDeleted(PluginDeletionNotifyAdapter *adapter) { void *handle = m_pluginLibraryHandleMap[adapter]; - if (handle) Files::unloadLibrary(handle); + if (!handle) return; + m_pluginLibraryHandleMap.erase(adapter); + + for (auto h: m_pluginLibraryHandleMap) { + if (h.second == handle) { + // still in use + return; + } + } + + Files::unloadLibrary(handle); } PluginLoader::Impl::PluginDeletionNotifyAdapter::PluginDeletionNotifyAdapter(Plugin *plugin,