Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Fixed bug 1113 - SDL_SetEventFilter()'s event deletion process is not…
… safe against intervening event push.

This is not completely thread-safe since it's possible for an event to come in and be unfiltered between the flush call and the setting of the new filter, but it's much better than it was.
  • Loading branch information
slouken committed May 21, 2013
1 parent 5f6ef90 commit 6aabd8c1faae3cd4310e7953708150736c1de804
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/events/SDL_events.c
@@ -388,12 +388,11 @@ SDL_PushEvent(SDL_Event * event)
void
SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
{
SDL_Event bitbucket;

/* Set filter and discard pending events */
SDL_EventOK = filter;
SDL_EventOK = NULL;
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
SDL_EventOKParam = userdata;
while (SDL_PollEvent(&bitbucket) > 0);
SDL_EventOK = filter;
}

SDL_bool

0 comments on commit 6aabd8c

Please sign in to comment.