summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 ");