- D_ProcessEvents(): Fix bad setup with delayedevents array that was holding pointers to items in the events[] array instead of making a copy.

This commit is contained in:
Mitch Richters 2021-11-20 22:38:54 +11:00 committed by Christoph Oelckers
parent c4f7760ab2
commit b1fea228be

View file

@ -68,7 +68,7 @@ CVAR(Bool, m_filter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
void D_ProcessEvents (void) void D_ProcessEvents (void)
{ {
bool keywasdown[NUM_KEYS] = { false }; bool keywasdown[NUM_KEYS] = { false };
TArray<event_t*> delayedevents; TArray<event_t> delayedevents;
while (eventtail != eventhead) while (eventtail != eventhead)
{ {
@ -77,7 +77,7 @@ void D_ProcessEvents (void)
if (ev->type == EV_KeyUp && keywasdown[ev->data1]) if (ev->type == EV_KeyUp && keywasdown[ev->data1])
{ {
delayedevents.Push(ev); delayedevents.Push(*ev);
continue; continue;
} }
@ -99,7 +99,7 @@ void D_ProcessEvents (void)
for (auto& ev: delayedevents) for (auto& ev: delayedevents)
{ {
D_PostEvent(ev); D_PostEvent(&ev);
} }
} }