Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Handle assert init/quit better.

Don't create a mutex unles we need to, only clean it up if we made it.
  • Loading branch information
icculus committed Jan 13, 2010
1 parent 8c26e99 commit 0a5d41123d342acb78a179405d01cfd9335405a4
Showing with 5 additions and 8 deletions.
  1. +5 −8 src/SDL_assert.c
@@ -422,21 +422,18 @@ 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;
}

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
}

0 comments on commit 0a5d411

Please sign in to comment.