Fix double free when destroying event thread for a second time. gsoc2009_unit_tests
authorEdgar Simo <bobbens@gmail.com>
Sat, 11 Jul 2009 19:06:49 +0000
branchgsoc2009_unit_tests
changeset 3726 ffe22900a50a
parent 3725 6eca2af6a86b
child 3727 51900b161948
Fix double free when destroying event thread for a second time.
src/events/SDL_events.c
--- a/src/events/SDL_events.c	Sat Jul 11 18:54:03 2009 +0000
+++ b/src/events/SDL_events.c	Sat Jul 11 19:06:49 2009 +0000
@@ -196,7 +196,10 @@
         SDL_DestroyMutex(SDL_EventLock.lock);
     }
 #ifndef IPOD
-    SDL_DestroyMutex(SDL_EventQ.lock);
+    if (SDL_EventQ.lock) {
+        SDL_DestroyMutex(SDL_EventQ.lock);
+        SDL_EventQ.lock = NULL;
+    }
 #endif
 }