Fixed potential deadlock in HandleSystem::TryAndFreeSomeHandles (bug 5665, r=dvander).
authorKyle Sanderson <kyle.leet@gmail.com>
Sun Aug 25 09:59:13 2013 -0400 (2013-08-25)
changeset 405965557adee9a8
parent 4058 c3ebd769e128
child 4060 b4484bd36c22
Fixed potential deadlock in HandleSystem::TryAndFreeSomeHandles (bug 5665, r=dvander).
core/logic/HandleSys.cpp
     1.1 --- a/core/logic/HandleSys.cpp	Sun Aug 25 01:42:16 2013 -0700
     1.2 +++ b/core/logic/HandleSys.cpp	Sun Aug 25 09:59:13 2013 -0400
     1.3 @@ -35,6 +35,7 @@
     1.4  #include "common_logic.h"
     1.5  #include "ShareSys.h"
     1.6  #include "ExtensionSys.h"
     1.7 +#include "PluginSys.h"
     1.8  
     1.9  HandleSystem g_HandleSys;
    1.10  
    1.11 @@ -981,12 +982,11 @@
    1.12  
    1.13  bool HandleSystem::TryAndFreeSomeHandles()
    1.14  {
    1.15 -	IPluginIterator *pl_iter = scripts->GetPluginIterator();
    1.16  	IPlugin *highest_owner = NULL;
    1.17  	unsigned int highest_handle_count = 0;
    1.18  
    1.19  	/* Search all plugins */
    1.20 -	while (pl_iter->MorePlugins())
    1.21 +	for (IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator(); pl_iter->MorePlugins(); pl_iter->NextPlugin())
    1.22  	{
    1.23  		IPlugin *plugin = pl_iter->GetPlugin();
    1.24  		IdentityToken_t *identity = plugin->GetIdentity();
    1.25 @@ -1015,8 +1015,6 @@
    1.26  			highest_owner = plugin;
    1.27  			highest_handle_count = handle_count;
    1.28  		}
    1.29 -
    1.30 -		pl_iter->NextPlugin();
    1.31  	}
    1.32  
    1.33  	if (highest_owner == NULL || highest_handle_count == 0)