summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-07-01 19:48:52 +0000
committerrubidium <rubidium@openttd.org>2013-07-01 19:48:52 +0000
commitd9065fbfbe567a621e4d5051494ca76f1bbd36d5 (patch)
treebae8dbd1907a4df784a9fd779f5d06074345c9b0 /src
parent68659495b552868bb9483da6385932085ec0e2a8 (diff)
downloadopenttd-d9065fbfbe567a621e4d5051494ca76f1bbd36d5.tar.xz
(svn r25550) -Fix [FS#5571]: [Windows] Race condition between two drawing threads could crash OpenTTD
Diffstat (limited to 'src')
-rw-r--r--src/video/win32_v.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index c72b87bca..922f8ba89 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -176,6 +176,7 @@ static void ClientSizeChanged(int w, int h)
{
/* allocate new dib section of the new size */
if (AllocateDibSection(w, h)) {
+ if (_draw_mutex != NULL) _draw_mutex->BeginCritical();
/* mark all palette colours dirty */
_cur_palette.first_dirty = 0;
_cur_palette.count_dirty = 256;
@@ -190,6 +191,8 @@ static void ClientSizeChanged(int w, int h)
_screen.dst_ptr = _wnd.buffer_bits;
UpdateWindows();
}
+
+ if (_draw_mutex != NULL) _draw_mutex->EndCritical();
}
}