Skip to content

Commit

Permalink
- D_ProcessEvents(): Fix bad setup with delayedevents array that …
Browse files Browse the repository at this point in the history
…was holding pointers to items in the `events[]` array instead of making a copy.
  • Loading branch information
mjr4077au authored and coelckers committed Nov 21, 2021
1 parent c4f7760 commit b1fea22
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/common/engine/d_event.cpp
Expand Up @@ -68,7 +68,7 @@ CVAR(Bool, m_filter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
void D_ProcessEvents (void)
{
bool keywasdown[NUM_KEYS] = { false };
TArray<event_t*> delayedevents;
TArray<event_t> delayedevents;

while (eventtail != eventhead)
{
Expand All @@ -77,7 +77,7 @@ void D_ProcessEvents (void)

if (ev->type == EV_KeyUp && keywasdown[ev->data1])
{
delayedevents.Push(ev);
delayedevents.Push(*ev);
continue;
}

Expand All @@ -99,7 +99,7 @@ void D_ProcessEvents (void)

for (auto& ev: delayedevents)
{
D_PostEvent(ev);
D_PostEvent(&ev);
}
}

Expand Down

0 comments on commit b1fea22

Please sign in to comment.