changeset 3664:8bdc37b1a52a

Handle assert init/quit better. Don't create a mutex unles we need to, only clean it up if we made it.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 13 Jan 2010 16:08:03 +0000
parents bc50cd16bb07
children 97114af2f8dc
files src/SDL_assert.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/SDL_assert.c	Wed Jan 13 09:48:42 2010 +0000
+++ b/src/SDL_assert.c	Wed Jan 13 16:08:03 2010 +0000
@@ -422,12 +422,7 @@
 
 int SDL_AssertionsInit(void)
 {
-#if (SDL_ASSERT_LEVEL > 0)
-    assertion_mutex = SDL_CreateMutex();
-    if (assertion_mutex == NULL) {
-        return -1;
-    }
-#endif
+    /* this is a no-op at the moment. */
     return 0;
 }
 
@@ -435,8 +430,10 @@
 {
 #if (SDL_ASSERT_LEVEL > 0)
     SDL_GenerateAssertionReport();
-    SDL_DestroyMutex(assertion_mutex);
-    assertion_mutex = NULL;
+    if (assertion_mutex != NULL) {
+        SDL_DestroyMutex(assertion_mutex);
+        assertion_mutex = NULL;
+    }
 #endif
 }