mirror of
https://github.com/yawut/SDL.git
synced 2026-08-26 02:35:06 -05:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user