Handle assert init/quit better.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 13 Jan 2010 16:08:03 +0000
changeset 36648bdc37b1a52a
parent 3663 bc50cd16bb07
child 3665 97114af2f8dc
Handle assert init/quit better.

Don't create a mutex unles we need to, only clean it up if we made it.
src/SDL_assert.c
     1.1 --- a/src/SDL_assert.c	Wed Jan 13 09:48:42 2010 +0000
     1.2 +++ b/src/SDL_assert.c	Wed Jan 13 16:08:03 2010 +0000
     1.3 @@ -422,12 +422,7 @@
     1.4  
     1.5  int SDL_AssertionsInit(void)
     1.6  {
     1.7 -#if (SDL_ASSERT_LEVEL > 0)
     1.8 -    assertion_mutex = SDL_CreateMutex();
     1.9 -    if (assertion_mutex == NULL) {
    1.10 -        return -1;
    1.11 -    }
    1.12 -#endif
    1.13 +    /* this is a no-op at the moment. */
    1.14      return 0;
    1.15  }
    1.16  
    1.17 @@ -435,8 +430,10 @@
    1.18  {
    1.19  #if (SDL_ASSERT_LEVEL > 0)
    1.20      SDL_GenerateAssertionReport();
    1.21 -    SDL_DestroyMutex(assertion_mutex);
    1.22 -    assertion_mutex = NULL;
    1.23 +    if (assertion_mutex != NULL) {
    1.24 +        SDL_DestroyMutex(assertion_mutex);
    1.25 +        assertion_mutex = NULL;
    1.26 +    }
    1.27  #endif
    1.28  }
    1.29