Added an assert to catch init/quit call mismatch that might bite people.
authorSam Lantinga <slouken@libsdl.org>
Sun, 13 Oct 2013 19:48:45 -0700
changeset 7810 ab1b92bf0327
parent 7809 fd53b2b2a205
child 7811 9dfcc6bad831
Added an assert to catch init/quit call mismatch that might bite people.
src/SDL.c
--- a/src/SDL.c	Sun Oct 13 17:15:43 2013 -0300
+++ b/src/SDL.c	Sun Oct 13 19:48:45 2013 -0700
@@ -65,6 +65,8 @@
 SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem)
 {
     int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
+    /* If this assert triggers there is a mismatch between init and quit calls */
+    SDL_assert(SDL_SubsystemRefCount[subsystem_index] > 0);
     if (SDL_SubsystemRefCount[subsystem_index] > 0) {
         --SDL_SubsystemRefCount[subsystem_index];
     }