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:
parent
97fba74bda
commit
3d5e0ce562
1 changed files with 3 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue