core/systems/PluginSys.cpp
branchrefac-jit
changeset 2191 426832b7b7bd
parent 2175 54a8411faaac
     1.1 --- a/core/systems/PluginSys.cpp	Fri Jul 11 05:14:32 2008 +0000
     1.2 +++ b/core/systems/PluginSys.cpp	Fri Jul 11 05:15:43 2008 +0000
     1.3 @@ -111,6 +111,7 @@
     1.4  		m_ident = g_ShareSys.CreateIdentity(g_PluginIdent, this);
     1.5  		m_handle = g_HandleSys.CreateHandle(g_PluginType, this, g_PluginSys.GetIdentity(), g_PluginSys.GetIdentity(), NULL);
     1.6  		m_pRuntime->GetDefaultContext()->SetKey(1, m_ident);
     1.7 +		m_pRuntime->GetDefaultContext()->SetKey(2, (IPlugin *)this);
     1.8  	}
     1.9  }
    1.10  
    1.11 @@ -1563,16 +1564,14 @@
    1.12  
    1.13  IPlugin *CPluginManager::FindPluginByContext(const sp_context_t *ctx)
    1.14  {
    1.15 -	List<CPlugin *>::iterator iter;
    1.16 +	IPlugin *pPlugin;
    1.17 +	IPluginContext *pContext;
    1.18  
    1.19 -	/* :TODO: :TODO: respeed this up somehow */
    1.20 -	for (iter = m_plugins.begin(); iter != m_plugins.end(); iter++)
    1.21 +	pContext = reinterpret_cast<IPluginContext *>(const_cast<sp_context_t *>(ctx));
    1.22 +
    1.23 +	if (pContext->GetKey(2, (void **)&pPlugin))
    1.24  	{
    1.25 -		CPlugin *pl = (*iter);
    1.26 -		if (pl->m_pRuntime != NULL && pl->m_pRuntime->GetDefaultContext()->GetContext() == ctx)
    1.27 -		{
    1.28 -			return pl;
    1.29 -		}
    1.30 +		return pPlugin;
    1.31  	}
    1.32  
    1.33  	return NULL;