summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-11-02 12:12:13 +0000
committersmatz <smatz@openttd.org>2009-11-02 12:12:13 +0000
commitdc4b251dbd8aa17f2af6f0dfb84515bb461f8b32 (patch)
treea857473f8d051b924643825f1a2ea1ceaf8f80fb
parent44013ba8890d446991a2430e82efdd0782915815 (diff)
downloadopenttd-dc4b251dbd8aa17f2af6f0dfb84515bb461f8b32.tar.xz
(svn r17949) -Fix (r17776): unlock mutex before deleting it when creating drawing thread failed
-rw-r--r--src/video/sdl_v.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index 15c3ef37d..a0fb3c6d6 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -507,10 +507,13 @@ void VideoDriver_SDL::MainLoop()
_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) delete _draw_mutex;
+ /* Free the mutex if we won't be able to use it. */
+ if (!_draw_threaded) {
+ _draw_mutex->EndCritical();
+ delete _draw_mutex;
+ }
+ }
}
DEBUG(driver, 1, "SDL: using %sthreads", _draw_threaded ? "" : "no ");