diff --git a/src/events.cpp b/src/events.cpp index 7499c57137..822f368318 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -75,6 +75,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;