Handle assert init/quit better.

Don't create a mutex unles we need to, only clean it up if we made it.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404415
This commit is contained in:
Ryan C. Gordon 2010-01-13 16:08:03 +00:00
parent c47e208c6b
commit 5c1ec528fa

View file

@ -422,12 +422,7 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
int SDL_AssertionsInit(void) int SDL_AssertionsInit(void)
{ {
#if (SDL_ASSERT_LEVEL > 0) /* this is a no-op at the moment. */
assertion_mutex = SDL_CreateMutex();
if (assertion_mutex == NULL) {
return -1;
}
#endif
return 0; return 0;
} }
@ -435,8 +430,10 @@ void SDL_AssertionsQuit(void)
{ {
#if (SDL_ASSERT_LEVEL > 0) #if (SDL_ASSERT_LEVEL > 0)
SDL_GenerateAssertionReport(); SDL_GenerateAssertionReport();
if (assertion_mutex != NULL) {
SDL_DestroyMutex(assertion_mutex); SDL_DestroyMutex(assertion_mutex);
assertion_mutex = NULL; assertion_mutex = NULL;
}
#endif #endif
} }