Fixed potential deadlock in HandleSystem::TryAndFreeSomeHandles (bug 5665, r=dvander).

This commit is contained in:
Kyle Sanderson 2013-08-25 09:59:13 -04:00
parent d14b5fe00b
commit 2b6257e94e

View File

@ -35,6 +35,7 @@
#include "common_logic.h" #include "common_logic.h"
#include "ShareSys.h" #include "ShareSys.h"
#include "ExtensionSys.h" #include "ExtensionSys.h"
#include "PluginSys.h"
HandleSystem g_HandleSys; HandleSystem g_HandleSys;
@ -981,12 +982,11 @@ bool HandleSystem::InitAccessDefaults(TypeAccess *pTypeAccess, HandleAccess *pHa
bool HandleSystem::TryAndFreeSomeHandles() bool HandleSystem::TryAndFreeSomeHandles()
{ {
IPluginIterator *pl_iter = scripts->GetPluginIterator();
IPlugin *highest_owner = NULL; IPlugin *highest_owner = NULL;
unsigned int highest_handle_count = 0; unsigned int highest_handle_count = 0;
/* Search all plugins */ /* Search all plugins */
while (pl_iter->MorePlugins()) for (IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator(); pl_iter->MorePlugins(); pl_iter->NextPlugin())
{ {
IPlugin *plugin = pl_iter->GetPlugin(); IPlugin *plugin = pl_iter->GetPlugin();
IdentityToken_t *identity = plugin->GetIdentity(); IdentityToken_t *identity = plugin->GetIdentity();
@ -1015,8 +1015,6 @@ bool HandleSystem::TryAndFreeSomeHandles()
highest_owner = plugin; highest_owner = plugin;
highest_handle_count = handle_count; highest_handle_count = handle_count;
} }
pl_iter->NextPlugin();
} }
if (highest_owner == NULL || highest_handle_count == 0) if (highest_owner == NULL || highest_handle_count == 0)