diff src/video/SDL_rect.c @ 2224:29cc9e9c76bd

Whoops, it's not quite that easy - fixed bug in SDL_ClearDirtyRects()
author Sam Lantinga <slouken@libsdl.org>
date Sat, 11 Aug 2007 21:42:36 +0000
parents 175754591a13
children 12ea0fdc0df2
line wrap: on
line diff
--- a/src/video/SDL_rect.c	Sat Aug 11 21:34:08 2007 +0000
+++ b/src/video/SDL_rect.c	Sat Aug 11 21:42:36 2007 +0000
@@ -149,7 +149,20 @@
 void
 SDL_ClearDirtyRects(SDL_DirtyRectList * list)
 {
-    list->free = list->list;
+    SDL_DirtyRect *prev, *curr;
+
+    /* Skip to the end of the free list */
+    prev = NULL;
+    for (curr = list->free; curr; curr = curr->next) {
+        prev = curr;
+    }
+
+    /* Add the list entries to the end */
+    if (prev) {
+        prev->next = list->list;
+    } else {
+        list->free = list->list;
+    }
     list->list = NULL;
     list->count = 0;
 }