src/video/SDL_video.c
changeset 7719 31b5f9ff36ca
parent 7698 a60b3c292f0f
child 7720 f9a649383362
equal deleted inserted replaced
7718:213b9777e988 7719:31b5f9ff36ca
   261     /* Free any old texture and pixel data */
   261     /* Free any old texture and pixel data */
   262     if (data->texture) {
   262     if (data->texture) {
   263         SDL_DestroyTexture(data->texture);
   263         SDL_DestroyTexture(data->texture);
   264         data->texture = NULL;
   264         data->texture = NULL;
   265     }
   265     }
   266     if (data->pixels) {
   266     SDL_free(data->pixels);
   267         SDL_free(data->pixels);
   267     data->pixels = NULL;
   268         data->pixels = NULL;
       
   269     }
       
   270 
   268 
   271     if (SDL_GetRendererInfo(data->renderer, &info) < 0) {
   269     if (SDL_GetRendererInfo(data->renderer, &info) < 0) {
   272         return -1;
   270         return -1;
   273     }
   271     }
   274 
   272 
   349         SDL_DestroyTexture(data->texture);
   347         SDL_DestroyTexture(data->texture);
   350     }
   348     }
   351     if (data->renderer) {
   349     if (data->renderer) {
   352         SDL_DestroyRenderer(data->renderer);
   350         SDL_DestroyRenderer(data->renderer);
   353     }
   351     }
   354     if (data->pixels) {
   352     SDL_free(data->pixels);
   355         SDL_free(data->pixels);
       
   356     }
       
   357     SDL_free(data);
   353     SDL_free(data);
   358 }
   354 }
   359 
   355 
   360 
   356 
   361 static int
   357 static int
  1405     CHECK_WINDOW_MAGIC(window, );
  1401     CHECK_WINDOW_MAGIC(window, );
  1406 
  1402 
  1407     if (title == window->title) {
  1403     if (title == window->title) {
  1408         return;
  1404         return;
  1409     }
  1405     }
  1410     if (window->title) {
  1406     SDL_free(window->title);
  1411         SDL_free(window->title);
       
  1412     }
       
  1413     if (title && *title) {
  1407     if (title && *title) {
  1414         window->title = SDL_strdup(title);
  1408         window->title = SDL_strdup(title);
  1415     } else {
  1409     } else {
  1416         window->title = NULL;
  1410         window->title = NULL;
  1417     }
  1411     }
  2186 
  2180 
  2187     /* Now invalidate magic */
  2181     /* Now invalidate magic */
  2188     window->magic = NULL;
  2182     window->magic = NULL;
  2189 
  2183 
  2190     /* Free memory associated with the window */
  2184     /* Free memory associated with the window */
  2191     if (window->title) {
  2185     SDL_free(window->title);
  2192         SDL_free(window->title);
       
  2193     }
       
  2194     if (window->icon) {
  2186     if (window->icon) {
  2195         SDL_FreeSurface(window->icon);
  2187         SDL_FreeSurface(window->icon);
  2196     }
  2188     }
  2197     if (window->gamma) {
  2189     SDL_free(window->gamma);
  2198         SDL_free(window->gamma);
       
  2199     }
       
  2200     while (window->data) {
  2190     while (window->data) {
  2201         SDL_WindowUserData *data = window->data;
  2191         SDL_WindowUserData *data = window->data;
  2202 
  2192 
  2203         window->data = data->next;
  2193         window->data = data->next;
  2204         SDL_free(data->name);
  2194         SDL_free(data->name);
  2281     _this->VideoQuit(_this);
  2271     _this->VideoQuit(_this);
  2282 
  2272 
  2283     for (i = 0; i < _this->num_displays; ++i) {
  2273     for (i = 0; i < _this->num_displays; ++i) {
  2284         SDL_VideoDisplay *display = &_this->displays[i];
  2274         SDL_VideoDisplay *display = &_this->displays[i];
  2285         for (j = display->num_display_modes; j--;) {
  2275         for (j = display->num_display_modes; j--;) {
  2286             if (display->display_modes[j].driverdata) {
  2276             SDL_free(display->display_modes[j].driverdata);
  2287                 SDL_free(display->display_modes[j].driverdata);
  2277             display->display_modes[j].driverdata = NULL;
  2288                 display->display_modes[j].driverdata = NULL;
  2278         }
  2289             }
  2279         SDL_free(display->display_modes);
  2290         }
  2280         display->display_modes = NULL;
  2291         if (display->display_modes) {
  2281         SDL_free(display->desktop_mode.driverdata);
  2292             SDL_free(display->display_modes);
  2282         display->desktop_mode.driverdata = NULL;
  2293             display->display_modes = NULL;
  2283         SDL_free(display->driverdata);
  2294         }
  2284         display->driverdata = NULL;
  2295         if (display->desktop_mode.driverdata) {
       
  2296             SDL_free(display->desktop_mode.driverdata);
       
  2297             display->desktop_mode.driverdata = NULL;
       
  2298         }
       
  2299         if (display->driverdata) {
       
  2300             SDL_free(display->driverdata);
       
  2301             display->driverdata = NULL;
       
  2302         }
       
  2303     }
  2285     }
  2304     if (_this->displays) {
  2286     if (_this->displays) {
  2305         for (i = 0; i < _this->num_displays; ++i) {
  2287         for (i = 0; i < _this->num_displays; ++i) {
  2306             SDL_free(_this->displays[i].name);
  2288             SDL_free(_this->displays[i].name);
  2307         }
  2289         }
  2308         SDL_free(_this->displays);
  2290         SDL_free(_this->displays);
  2309         _this->displays = NULL;
  2291         _this->displays = NULL;
  2310         _this->num_displays = 0;
  2292         _this->num_displays = 0;
  2311     }
  2293     }
  2312     if (_this->clipboard_text) {
  2294     SDL_free(_this->clipboard_text);
  2313         SDL_free(_this->clipboard_text);
  2295     _this->clipboard_text = NULL;
  2314         _this->clipboard_text = NULL;
       
  2315     }
       
  2316     _this->free(_this);
  2296     _this->free(_this);
  2317     _this = NULL;
  2297     _this = NULL;
  2318 }
  2298 }
  2319 
  2299 
  2320 int
  2300 int