comparison src/video/SDL_video.c @ 3693:d3f330fc2009

update window prev links
author Sam Lantinga <slouken@libsdl.org>
date Fri, 22 Jan 2010 16:17:11 +0000
parents ad85eb21a559
children b0a707f589a6
comparison
equal deleted inserted replaced
3692:ad85eb21a559 3693:d3f330fc2009
901 window->w = w; 901 window->w = w;
902 window->h = h; 902 window->h = h;
903 window->flags = (flags & allowed_flags); 903 window->flags = (flags & allowed_flags);
904 window->display = display; 904 window->display = display;
905 window->next = display->windows; 905 window->next = display->windows;
906 if (display->windows) {
907 display->windows->prev = window;
908 }
906 display->windows = window; 909 display->windows = window;
907 910
908 if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) { 911 if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) {
909 SDL_DestroyWindow(window); 912 SDL_DestroyWindow(window);
910 return NULL; 913 return NULL;
941 window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); 944 window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
942 window->id = _this->next_object_id++; 945 window->id = _this->next_object_id++;
943 window->flags = SDL_WINDOW_FOREIGN; 946 window->flags = SDL_WINDOW_FOREIGN;
944 window->display = display; 947 window->display = display;
945 window->next = display->windows; 948 window->next = display->windows;
949 if (display->windows) {
950 display->windows->prev = window;
951 }
946 display->windows = window; 952 display->windows = window;
947 953
948 if (!_this->CreateWindowFrom || 954 if (!_this->CreateWindowFrom ||
949 _this->CreateWindowFrom(_this, window, data) < 0) { 955 _this->CreateWindowFrom(_this, window, data) < 0) {
950 SDL_DestroyWindow(window); 956 SDL_DestroyWindow(window);
1450 SDL_GL_UnloadLibrary(); 1456 SDL_GL_UnloadLibrary();
1451 } 1457 }
1452 1458
1453 /* Unlink the window from the list */ 1459 /* Unlink the window from the list */
1454 display = window->display; 1460 display = window->display;
1461 if (window->next) {
1462 window->next->prev = window->prev;
1463 }
1455 if (window->prev) { 1464 if (window->prev) {
1456 window->prev->next = window->next; 1465 window->prev->next = window->next;
1457 } else { 1466 } else {
1458 display->windows = window->next; 1467 display->windows = window->next;
1459 } 1468 }