- fixed potentially missing event handlers

Event handlers linked list might skip an entry if its order was in a middle of existing handlers

https://forum.zdoom.org/viewtopic.php?t=63258
This commit is contained in:
alexey.lysiuk 2019-01-15 16:22:25 +02:00 committed by drfrag
parent db0928be4d
commit 53a1fb5705

View file

@ -76,6 +76,11 @@ bool E_RegisterHandler(DStaticEventHandler* handler)
{
// if before is not null, link it before the existing handler.
// note that before can be first handler, check for this.
if (before->prev != nullptr)
{
before->prev->next = handler;
GC::WriteBarrier(before->prev, handler);
}
handler->next = before;
GC::WriteBarrier(handler, before);
handler->prev = before->prev;