Fixed bug 3022 - SDL_UnlockMutex(SDL_EventQ.lock) in SDL_PeepEvents can cause error when lock is null
authorSam Lantinga
Fri, 07 Oct 2016 17:58:02 -0700
changeset 104883e61babccbbe
parent 10487 bd16e5899ceb
child 10489 1e1ce9f6d215
Fixed bug 3022 - SDL_UnlockMutex(SDL_EventQ.lock) in SDL_PeepEvents can cause error when lock is null
src/events/SDL_events.c
     1.1 --- a/src/events/SDL_events.c	Fri Oct 07 17:49:33 2016 -0700
     1.2 +++ b/src/events/SDL_events.c	Fri Oct 07 17:58:02 2016 -0700
     1.3 @@ -332,7 +332,9 @@
     1.4                  }
     1.5              }
     1.6          }
     1.7 -        SDL_UnlockMutex(SDL_EventQ.lock);
     1.8 +        if (SDL_EventQ.lock) {
     1.9 +            SDL_UnlockMutex(SDL_EventQ.lock);
    1.10 +        }
    1.11      } else {
    1.12          return SDL_SetError("Couldn't lock event queue");
    1.13      }
    1.14 @@ -374,7 +376,7 @@
    1.15  #endif
    1.16  
    1.17      /* Lock the event queue */
    1.18 -    if (SDL_LockMutex(SDL_EventQ.lock) == 0) {
    1.19 +    if (SDL_EventQ.lock && SDL_LockMutex(SDL_EventQ.lock) == 0) {
    1.20          SDL_EventEntry *entry, *next;
    1.21          Uint32 type;
    1.22          for (entry = SDL_EventQ.head; entry; entry = next) {