From 2b6257e94e5870e797b6c9fbd9b17570bc10325a Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Sun, 25 Aug 2013 09:59:13 -0400 Subject: [PATCH] Fixed potential deadlock in HandleSystem::TryAndFreeSomeHandles (bug 5665, r=dvander). --- core/logic/HandleSys.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/logic/HandleSys.cpp b/core/logic/HandleSys.cpp index dbfea4f5..5ef76c15 100644 --- a/core/logic/HandleSys.cpp +++ b/core/logic/HandleSys.cpp @@ -35,6 +35,7 @@ #include "common_logic.h" #include "ShareSys.h" #include "ExtensionSys.h" +#include "PluginSys.h" HandleSystem g_HandleSys; @@ -981,12 +982,11 @@ bool HandleSystem::InitAccessDefaults(TypeAccess *pTypeAccess, HandleAccess *pHa bool HandleSystem::TryAndFreeSomeHandles() { - IPluginIterator *pl_iter = scripts->GetPluginIterator(); IPlugin *highest_owner = NULL; unsigned int highest_handle_count = 0; /* 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(); IdentityToken_t *identity = plugin->GetIdentity(); @@ -1015,8 +1015,6 @@ bool HandleSystem::TryAndFreeSomeHandles() highest_owner = plugin; highest_handle_count = handle_count; } - - pl_iter->NextPlugin(); } if (highest_owner == NULL || highest_handle_count == 0)