From 0a5d41123d342acb78a179405d01cfd9335405a4 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 13 Jan 2010 16:08:03 +0000 Subject: [PATCH] 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 | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/SDL_assert.c b/src/SDL_assert.c index 51301242e..9a4048ebe 100644 --- a/src/SDL_assert.c +++ b/src/SDL_assert.c @@ -422,12 +422,7 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, 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 @@ void SDL_AssertionsQuit(void) { #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 }