Browse Source

Make sure we're not trying to add temporary memory twice

Sam Lantinga 1 year ago
parent
commit
bebde1c4c9
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/events/SDL_events.c

+ 3 - 0
src/events/SDL_events.c

@@ -268,6 +268,9 @@ void *SDL_FreeLater(void *memory)
         return NULL;
         return NULL;
     }
     }
 
 
+    // Make sure we're not adding this to the list twice
+    SDL_assert(!SDL_ClaimTemporaryMemory(memory));
+
     state = SDL_GetTemporaryMemoryState(SDL_TRUE);
     state = SDL_GetTemporaryMemoryState(SDL_TRUE);
     if (!state) {
     if (!state) {
         return memory;  // this is now a leak, but you probably have bigger problems if malloc failed.
         return memory;  // this is now a leak, but you probably have bigger problems if malloc failed.