--- a/src/thread/SDL_thread.c Thu Apr 11 18:22:05 2002 +0000
+++ b/src/thread/SDL_thread.c Thu Apr 11 21:08:44 2002 +0000
@@ -146,10 +146,15 @@
}
}
if ( i < SDL_numthreads ) {
- --SDL_numthreads;
- while ( i < SDL_numthreads ) {
- SDL_Threads[i] = SDL_Threads[i+1];
- ++i;
+ if ( --SDL_numthreads > 0 ) {
+ while ( i < SDL_numthreads ) {
+ SDL_Threads[i] = SDL_Threads[i+1];
+ ++i;
+ }
+ } else {
+ SDL_maxthreads = 0;
+ free(SDL_Threads);
+ SDL_Threads = NULL;
}
#ifdef DEBUG_THREADS
printf("Deleting thread (%d left - %d max)\n",