diff options
author | wm4 <wm4@nowhere> | 2015-02-13 10:47:07 +0100 |
---|---|---|
committer | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2015-02-16 18:09:35 +0900 |
commit | cb5adf4d726e19e4966362fdf316892da484fefa (patch) | |
tree | a74bcec47fdc5d4d97121aa6318c65b1b431e72b | |
parent | 440ba3363966b6fa4394ca79074b5ba8a0f3a5a6 (diff) | |
download | mpv-cb5adf4d726e19e4966362fdf316892da484fefa.tar.bz2 mpv-cb5adf4d726e19e4966362fdf316892da484fefa.tar.xz |
cocoa: fix exiting the command line player
Commit e920a00eb assumed that terminate_cocoa_application() actually
would exit. But apparently that is not always the case; e.g. mpv --help
will just hang. The old code had a dummy exit(0), which was apparently
actually called. Fix by explicitly exiting if mpv_main() returns and
terminate_cocoa_application() does nothing.
(cherry picked from commit 9e14042e575435e94da660823d14aa6a6b6cb668)
-rw-r--r-- | osdep/macosx_application.m | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index 008622f3ea..39800dbbb6 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -273,11 +273,10 @@ static void *playback_thread(void *ctx_obj) mpthread_set_name("playback core (OSX)"); @autoreleasepool { struct playback_thread_ctx *ctx = (struct playback_thread_ctx*) ctx_obj; - ctx->mpv_main(*ctx->argc, *ctx->argv); + int r = ctx->mpv_main(*ctx->argc, *ctx->argv); terminate_cocoa_application(); - // normally never reached - cocoa_stop_runloop(); - pthread_exit(NULL); + // normally never reached - unless the cocoa mainloop hasn't started yet + exit(r); } } |