Fixed a crash in the Event Manager when a game fired an event from a listener that was looking for the same event (bug 3468, r=me).

In other words it was a problem where our FireEvent hooks were being re-entered for the _same_ game event. The Event Manager was not able to handle this and crashed.
This commit is contained in:
Scott Ehlert
2009-01-27 23:53:48 -06:00
parent a8e1a4f2fd
commit 7167a807bf
2 changed files with 16 additions and 12 deletions
+7 -2
View File
@@ -45,6 +45,12 @@ using namespace SourceHook;
struct EventInfo
{
EventInfo()
{
}
EventInfo(IGameEvent *ev, IdentityToken_t *owner) : pEvent(ev), pOwner(owner)
{
}
IGameEvent *pEvent;
IdentityToken_t *pOwner;
};
@@ -56,13 +62,11 @@ struct EventHook
pPreHook = NULL;
pPostHook = NULL;
postCopy = false;
pEventCopy = NULL;
refCount = 0;
}
IChangeableForward *pPreHook;
IChangeableForward *pPostHook;
bool postCopy;
IGameEvent *pEventCopy;
unsigned int refCount;
};
@@ -121,6 +125,7 @@ private:
Trie *m_EventHooks;
CStack<EventInfo *> m_FreeEvents;
CStack<const char *> m_EventNames;
CStack<IGameEvent *> m_EventCopies;
};
extern EventManager g_EventManager;