Commit a7b2db05cd77c91268b377a810450dc4b5976473

Sam Lantinga 2013-10-13T19:48:45

Added an assert to catch init/quit call mismatch that might bite people.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/SDL.c b/src/SDL.c
index d8c05fb..b111115 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -65,6 +65,8 @@ static void
 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];
     }