update window prev links
authorSam Lantinga <slouken@libsdl.org>
Fri, 22 Jan 2010 16:17:11 +0000
changeset 3693 d3f330fc2009
parent 3692 ad85eb21a559
child 3694 b0a707f589a6
update window prev links
src/video/SDL_video.c
--- a/src/video/SDL_video.c	Fri Jan 22 15:55:20 2010 +0000
+++ b/src/video/SDL_video.c	Fri Jan 22 16:17:11 2010 +0000
@@ -903,6 +903,9 @@
     window->flags = (flags & allowed_flags);
     window->display = display;
     window->next = display->windows;
+    if (display->windows) {
+        display->windows->prev = window;
+    }
     display->windows = window;
 
     if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) {
@@ -943,6 +946,9 @@
     window->flags = SDL_WINDOW_FOREIGN;
     window->display = display;
     window->next = display->windows;
+    if (display->windows) {
+        display->windows->prev = window;
+    }
     display->windows = window;
 
     if (!_this->CreateWindowFrom ||
@@ -1452,6 +1458,9 @@
 
     /* Unlink the window from the list */
     display = window->display;
+    if (window->next) {
+        window->next->prev = window->prev;
+    }
     if (window->prev) {
         window->prev->next = window->next;
     } else {