From 8a6126e90d9ca8d1b9055c1af25c4bd9b89431c0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 11 Aug 2007 21:42:36 +0000 Subject: [PATCH] Whoops, it's not quite that easy - fixed bug in SDL_ClearDirtyRects() --- src/video/SDL_rect.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_rect.c b/src/video/SDL_rect.c index cb9ef998e..9265d60e1 100644 --- a/src/video/SDL_rect.c +++ b/src/video/SDL_rect.c @@ -149,7 +149,20 @@ SDL_AddDirtyRect(SDL_DirtyRectList * list, const SDL_Rect * rect) 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; }