Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Handle assert init/quit better.
Browse files Browse the repository at this point in the history
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 0a5d411
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/SDL_assert.c
Expand Up @@ -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
}

Expand Down

0 comments on commit 0a5d411

Please sign in to comment.