mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-13 07:10:57 +00:00
(svn r26351) -Fix: Protect all VideoDriver_SDL methods with the _draw_mutex.
This commit is contained in:
parent
179d70fe16
commit
44003f0bae
@ -817,27 +817,34 @@ void VideoDriver_SDL::MainLoop()
|
|||||||
|
|
||||||
bool VideoDriver_SDL::ChangeResolution(int w, int h)
|
bool VideoDriver_SDL::ChangeResolution(int w, int h)
|
||||||
{
|
{
|
||||||
if (_draw_mutex != NULL) _draw_mutex->BeginCritical();
|
if (_draw_mutex != NULL) _draw_mutex->BeginCritical(true);
|
||||||
bool ret = CreateMainSurface(w, h);
|
bool ret = CreateMainSurface(w, h);
|
||||||
if (_draw_mutex != NULL) _draw_mutex->EndCritical();
|
if (_draw_mutex != NULL) _draw_mutex->EndCritical(true);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
|
bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
|
||||||
{
|
{
|
||||||
|
if (_draw_mutex != NULL) _draw_mutex->BeginCritical(true);
|
||||||
_fullscreen = fullscreen;
|
_fullscreen = fullscreen;
|
||||||
GetVideoModes(); // get the list of available video modes
|
GetVideoModes(); // get the list of available video modes
|
||||||
if (_num_resolutions == 0 || !CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
|
bool ret = _num_resolutions != 0 && CreateMainSurface(_cur_resolution.width, _cur_resolution.height);
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
/* switching resolution failed, put back full_screen to original status */
|
/* switching resolution failed, put back full_screen to original status */
|
||||||
_fullscreen ^= true;
|
_fullscreen ^= true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
if (_draw_mutex != NULL) _draw_mutex->EndCritical(true);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoDriver_SDL::AfterBlitterChange()
|
bool VideoDriver_SDL::AfterBlitterChange()
|
||||||
{
|
{
|
||||||
return CreateMainSurface(_screen.width, _screen.height);
|
if (_draw_mutex != NULL) _draw_mutex->BeginCritical(true);
|
||||||
|
bool ret = CreateMainSurface(_screen.width, _screen.height);
|
||||||
|
if (_draw_mutex != NULL) _draw_mutex->EndCritical(true);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* WITH_SDL */
|
#endif /* WITH_SDL */
|
||||||
|
Loading…
Reference in New Issue
Block a user