Remove CPlugin's friend access to CPluginManager.

This commit is contained in:
David Anderson
2015-10-31 17:19:09 -07:00
parent 8817b4277d
commit bda9defc0f
2 changed files with 13 additions and 9 deletions
+9 -6
View File
@@ -698,12 +698,9 @@ void CPlugin::DropEverything()
/* Other plugins could be holding weak references that were
* added by us. We need to clean all of those up now.
*/
for (List<CPlugin *>::iterator iter = g_PluginSys.m_plugins.begin();
iter != g_PluginSys.m_plugins.end();
iter++)
{
(*iter)->ToNativeOwner()->DropRefsTo(this);
}
g_PluginSys.ForEachPlugin([this] (CPlugin *other) -> void {
other->ToNativeOwner()->DropRefsTo(this);
});
/* Proceed with the rest of the necessities. */
CNativeOwner::DropEverything();
@@ -2488,6 +2485,12 @@ void CPluginManager::FreePluginList(const CVector<SMPlugin *> *list)
delete const_cast<CVector<SMPlugin *> *>(list);
}
void CPluginManager::ForEachPlugin(ke::Lambda<void(CPlugin *)> callback)
{
for (auto iter = m_plugins.begin(); iter != m_plugins.end(); iter++)
callback(*iter);
}
class OldPluginAPI : public IPluginManager
{
public: