fixed a bug where improper event removals could cause a crash
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401028
This commit is contained in:
parent
37622cece6
commit
1915dd049e
@ -262,7 +262,16 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
|
|||||||
IPlugin *plugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
|
IPlugin *plugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
|
||||||
|
|
||||||
/* Get plugin's event hook list */
|
/* Get plugin's event hook list */
|
||||||
plugin->GetProperty("EventHooks", (void**)&pHookList);
|
if (!plugin->GetProperty("EventHooks", (void**)&pHookList))
|
||||||
|
{
|
||||||
|
return EventHookErr_NotActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure the event was actually being hooked */
|
||||||
|
if (pHookList->find(pHook) == pHookList->end())
|
||||||
|
{
|
||||||
|
return EventHookErr_NotActive;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove current structure from plugin's list */
|
/* Remove current structure from plugin's list */
|
||||||
pHookList->remove(pHook);
|
pHookList->remove(pHook);
|
||||||
|
Loading…
Reference in New Issue
Block a user