Fixed using the event queue lock before the mutex was created.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 19 Apr 2013 11:58:38 -0400
changeset 7077 f8e3dcefed59
parent 7076 1666f7a7494e
child 7078 a2bddc1fb02f
Fixed using the event queue lock before the mutex was created. This has the benefit of ending the otherwise-bogus complaints that SDL_GetError() reports "Passed a NULL mutex" if you call it instead of checking if SDL_CreateWindow() actually succeeded. :)
src/events/SDL_events.c
--- a/src/events/SDL_events.c	Tue Apr 16 01:38:08 2013 -0400
+++ b/src/events/SDL_events.c	Fri Apr 19 11:58:38 2013 -0400
@@ -123,12 +123,6 @@
        FIXME: Does this introduce any other bugs with events at startup?
      */
 
-    /* No filter to start with, process most event types */
-    SDL_EventOK = NULL;
-    SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
-    SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
-    SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
-
     /* Create the lock and set ourselves active */
 #if !SDL_THREADS_DISABLED
     if (!SDL_EventQ.lock) {
@@ -138,6 +132,13 @@
         return (-1);
     }
 #endif /* !SDL_THREADS_DISABLED */
+
+    /* No filter to start with, process most event types */
+    SDL_EventOK = NULL;
+    SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
+    SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
+    SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
+
     SDL_EventQ.active = 1;
 
     return (0);