summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-19 19:29:01 +0000
committerrubidium <rubidium@openttd.org>2009-12-19 19:29:01 +0000
commitc811f3bd211aef10e55251789357b6cf4b9ec59a (patch)
treed85955bb3c799e178fbf3af1b0c1396c191386d4 /src
parenta6146f5f516ce08dfb9c5ad62b260ba2e3ae8010 (diff)
downloadopenttd-c811f3bd211aef10e55251789357b6cf4b9ec59a.tar.xz
(svn r18547) -Fix [FS#3388]: missing thread synchronisation when changing the resolution for SDL via the in game menu
Diffstat (limited to 'src')
-rw-r--r--src/video/sdl_v.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index d252287fb..7c39bdba0 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -469,7 +469,7 @@ static int PollEvent()
case SDL_VIDEORESIZE: {
int w = max(ev.resize.w, 64);
int h = max(ev.resize.h, 64);
- ChangeResInGame(w, h);
+ CreateMainSurface(w, h);
break;
}
}
@@ -627,14 +627,17 @@ void VideoDriver_SDL::MainLoop()
bool VideoDriver_SDL::ChangeResolution(int w, int h)
{
- return CreateMainSurface(w, h);
+ if (_draw_threaded) _draw_mutex->BeginCritical();
+ bool ret = CreateMainSurface(w, h);
+ if (_draw_threaded) _draw_mutex->EndCritical();
+ return ret;
}
bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
{
_fullscreen = fullscreen;
GetVideoModes(); // get the list of available video modes
- if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution.width, _cur_resolution.height)) {
+ if (_num_resolutions == 0 || !CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
/* switching resolution failed, put back full_screen to original status */
_fullscreen ^= true;
return false;