changeset 20606:517a1b2f0428 draft

(svn r25550) -Fix [FS#5571]: [Windows] Race condition between two drawing threads could crash OpenTTD
author rubidium <rubidium@openttd.org>
date Mon, 01 Jul 2013 19:48:52 +0000
parents 5b92d2148153
children 497874cbf20c
files src/video/win32_v.cpp
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -176,6 +176,7 @@
 {
 	/* 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 @@
 			_screen.dst_ptr = _wnd.buffer_bits;
 			UpdateWindows();
 		}
+
+		if (_draw_mutex != NULL) _draw_mutex->EndCritical();
 	}
 }