changeset 13440:b73679fb8d48 draft

(svn r17949) -Fix (r17776): unlock mutex before deleting it when creating drawing thread failed
author smatz <smatz@openttd.org>
date Mon, 02 Nov 2009 12:12:13 +0000
parents 0e90ffa69389
children 45b0849875f6
files src/video/sdl_v.cpp
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -507,10 +507,13 @@
 			_draw_continue = true;
 
 			_draw_threaded = ThreadObject::New(&DrawSurfaceToScreenThread, NULL, &_draw_thread);
+
+			/* Free the mutex if we won't be able to use it. */
+			if (!_draw_threaded) {
+				_draw_mutex->EndCritical();
+				delete _draw_mutex;
+			}
 		}
-
-		/* Free the mutex if we won't be able to use it. */
-		if (!_draw_threaded) delete _draw_mutex;
 	}
 
 	DEBUG(driver, 1, "SDL: using %sthreads", _draw_threaded ? "" : "no ");