From 53a1fb570564a1b87641f6e3831ffcdcd2c852b6 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 15 Jan 2019 16:22:25 +0200 Subject: [PATCH] - 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 --- src/events.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/events.cpp b/src/events.cpp index 17f06ec11..5b1ee9111 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -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;