# HG changeset patch # User rubidium # Date 1165167776 0 # Node ID 21c23507c0027a4d3ebae998fbc7edbcc734d665 # Parent d581e4db95b67bb38c71c3b79b143c2b4b91c9ce (svn r7332) -Fix: segmentation fault, discovered by ln-, in the SDL video driver when one goes to fullscreen and there are no suitable resolutions. diff -r d581e4db95b6 -r 21c23507c002 gfx.c --- a/gfx.c Sun Dec 03 17:27:43 2006 +0000 +++ b/gfx.c Sun Dec 03 17:42:56 2006 +0000 @@ -15,6 +15,7 @@ #include "table/control_codes.h" #include "fontcache.h" #include "genworld.h" +#include "debug.h" #ifdef _DEBUG bool _dbg_screen_rect; @@ -1998,7 +1999,13 @@ _video_driver->change_resolution(w, h); } -void ToggleFullScreen(bool fs) {_video_driver->toggle_fullscreen(fs);} +void ToggleFullScreen(bool fs) +{ + _video_driver->toggle_fullscreen(fs); + if (_fullscreen != fs && _num_resolutions == 0) { + DEBUG(misc, 0) ("Could not find a suitable fullscreen resolution."); + } +} static int CDECL compare_res(const void *pa, const void *pb) { diff -r d581e4db95b6 -r 21c23507c002 video/sdl_v.c --- a/video/sdl_v.c Sun Dec 03 17:27:43 2006 +0000 +++ b/video/sdl_v.c Sun Dec 03 17:42:56 2006 +0000 @@ -495,7 +495,7 @@ { _fullscreen = full_screen; GetVideoModes(); // get the list of available video modes - if (!_video_driver->change_resolution(_cur_resolution[0], _cur_resolution[1])) { + if (_num_resolutions == 0 || !_video_driver->change_resolution(_cur_resolution[0], _cur_resolution[1])) { // switching resolution failed, put back full_screen to original status _fullscreen ^= true; }