Add an OnPluginWillUnload callback that precedes OnPluginEnd().

This commit is contained in:
David Anderson
2015-11-01 00:30:37 -07:00
parent d674414cf0
commit c849616003
2 changed files with 27 additions and 1 deletions
+8
View File
@@ -1476,6 +1476,14 @@ void CPluginManager::Purge(CPlugin *plugin)
// Go through our libraries and tell other plugins they're gone.
plugin->LibraryActions(LibraryAction_Removed);
// Notify listeners of unloading.
if (plugin->EnteredSecondPass()) {
for (ListenerIter iter(m_listeners); !iter.done(); iter.next()) {
if ((*iter)->GetApiVersion() >= kMinPluginSysApiWithWillUnloadCallback)
(*iter)->OnPluginWillUnload(plugin);
}
}
// We only pair OnPluginEnd with OnPluginStart if we would have
// successfully called OnPluginStart, *and* SetFailState() wasn't called,
// which guarantees no further code will execute.