mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-12-02 08:53:42 +00:00
- fixed OnUnregister for Event handlers was called from a dead event manager instance.
This commit is contained in:
parent
c65ecbc807
commit
af6e2a430a
2 changed files with 7 additions and 9 deletions
|
@ -44,7 +44,6 @@
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
|
||||||
EventManager staticEventManager;
|
EventManager staticEventManager;
|
||||||
EventManager eventManager;
|
|
||||||
|
|
||||||
void EventManager::CallOnRegister()
|
void EventManager::CallOnRegister()
|
||||||
{
|
{
|
||||||
|
@ -262,7 +261,12 @@ void EventManager::InitStaticHandlers(FLevelLocals *l, bool map)
|
||||||
void EventManager::Shutdown()
|
void EventManager::Shutdown()
|
||||||
{
|
{
|
||||||
// delete handlers.
|
// delete handlers.
|
||||||
|
TArray<DStaticEventHandler *> list;
|
||||||
for (DStaticEventHandler* handler = LastEventHandler; handler; handler = handler->prev)
|
for (DStaticEventHandler* handler = LastEventHandler; handler; handler = handler->prev)
|
||||||
|
{
|
||||||
|
list.Push(handler);
|
||||||
|
}
|
||||||
|
for (auto handler : list)
|
||||||
{
|
{
|
||||||
handler->Destroy();
|
handler->Destroy();
|
||||||
}
|
}
|
||||||
|
@ -631,11 +635,6 @@ DEFINE_ACTION_FUNCTION(DStaticEventHandler, SetOrder)
|
||||||
PARAM_SELF_PROLOGUE(DStaticEventHandler);
|
PARAM_SELF_PROLOGUE(DStaticEventHandler);
|
||||||
PARAM_INT(order);
|
PARAM_INT(order);
|
||||||
|
|
||||||
/* not really needed - this is never checked again. To re-add, the handlers need a pointer to their manager but that's not worth it just for this check.
|
|
||||||
if (eventManager.CheckHandler(self))
|
|
||||||
return 0;
|
|
||||||
*/
|
|
||||||
|
|
||||||
self->Order = order;
|
self->Order = order;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1223,7 +1222,7 @@ void DStaticEventHandler::NewGame()
|
||||||
//
|
//
|
||||||
void DStaticEventHandler::OnDestroy()
|
void DStaticEventHandler::OnDestroy()
|
||||||
{
|
{
|
||||||
eventManager.UnregisterHandler(this);
|
owner->UnregisterHandler(this);
|
||||||
Super::OnDestroy();
|
Super::OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -332,5 +332,4 @@ struct EventManager
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EventManager eventManager;
|
extern EventManager staticEventManager;
|
||||||
extern EventManager staticEventManager;
|
|
||||||
|
|
Loading…
Reference in a new issue