1
0
Fork 0

(svn r26366) -Fix: Protect the windows video driver from concurrent access (frosch123)

release/1.4
fonsinchen 2014-02-23 14:16:36 +00:00
parent b4a015a4bd
commit d8eda06a5a
1 changed files with 14 additions and 3 deletions

View File

@ -1326,27 +1326,38 @@ void VideoDriver_Win32::MainLoop()
bool VideoDriver_Win32::ChangeResolution(int w, int h) bool VideoDriver_Win32::ChangeResolution(int w, int h)
{ {
if (_draw_mutex != NULL) _draw_mutex->BeginCritical(true);
if (_window_maximize) ShowWindow(_wnd.main_wnd, SW_SHOWNORMAL); if (_window_maximize) ShowWindow(_wnd.main_wnd, SW_SHOWNORMAL);
_wnd.width = _wnd.width_org = w; _wnd.width = _wnd.width_org = w;
_wnd.height = _wnd.height_org = h; _wnd.height = _wnd.height_org = h;
return this->MakeWindow(_fullscreen); // _wnd.fullscreen screws up ingame resolution switching bool ret = this->MakeWindow(_fullscreen); // _wnd.fullscreen screws up ingame resolution switching
if (_draw_mutex != NULL) _draw_mutex->EndCritical(true);
return ret;
} }
bool VideoDriver_Win32::ToggleFullscreen(bool full_screen) bool VideoDriver_Win32::ToggleFullscreen(bool full_screen)
{ {
return this->MakeWindow(full_screen); if (_draw_mutex != NULL) _draw_mutex->BeginCritical(true);
bool ret = this->MakeWindow(full_screen);
if (_draw_mutex != NULL) _draw_mutex->EndCritical(true);
return ret;
} }
bool VideoDriver_Win32::AfterBlitterChange() bool VideoDriver_Win32::AfterBlitterChange()
{ {
return AllocateDibSection(_screen.width, _screen.height, true) && this->MakeWindow(_fullscreen); if (_draw_mutex != NULL) _draw_mutex->BeginCritical(true);
bool ret = AllocateDibSection(_screen.width, _screen.height, true) && this->MakeWindow(_fullscreen);
if (_draw_mutex != NULL) _draw_mutex->EndCritical(true);
return ret;
} }
void VideoDriver_Win32::EditBoxLostFocus() void VideoDriver_Win32::EditBoxLostFocus()
{ {
if (_draw_mutex != NULL) _draw_mutex->BeginCritical(true);
CancelIMEComposition(_wnd.main_wnd); CancelIMEComposition(_wnd.main_wnd);
SetCompositionPos(_wnd.main_wnd); SetCompositionPos(_wnd.main_wnd);
SetCandidatePos(_wnd.main_wnd); SetCandidatePos(_wnd.main_wnd);
if (_draw_mutex != NULL) _draw_mutex->EndCritical(true);
} }