Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed bug 3022 - SDL_UnlockMutex(SDL_EventQ.lock) in SDL_PeepEvents c…
…an cause error when lock is null
  • Loading branch information
slouken committed Oct 8, 2016
1 parent d3cbc66 commit 5c2320f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/events/SDL_events.c
Expand Up @@ -332,7 +332,9 @@ SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action,
}
}
}
SDL_UnlockMutex(SDL_EventQ.lock);
if (SDL_EventQ.lock) {
SDL_UnlockMutex(SDL_EventQ.lock);
}
} else {
return SDL_SetError("Couldn't lock event queue");
}
Expand Down Expand Up @@ -374,7 +376,7 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType)
#endif

/* Lock the event queue */
if (SDL_LockMutex(SDL_EventQ.lock) == 0) {
if (SDL_EventQ.lock && SDL_LockMutex(SDL_EventQ.lock) == 0) {
SDL_EventEntry *entry, *next;
Uint32 type;
for (entry = SDL_EventQ.head; entry; entry = next) {
Expand Down

0 comments on commit 5c2320f

Please sign in to comment.