Get rid of GCD on macOS which breaks debug builds
With Grand Central Dispatch used in Main.cxx, debug builds on macOS crash as the IsInside() assertion gets triggered in the event loop. As a simple fix, usage of GCD is removed. Plugging and unplugging headphones or changes of the default output device was tested without issues. Whatever the original commit tried to fix by GCD probably does not need fixing anymore.
This commit is contained in:
parent
ef5f96a193
commit
79535212c8
1
NEWS
1
NEWS
@ -1,4 +1,5 @@
|
|||||||
ver 0.20.19 (not yet released)
|
ver 0.20.19 (not yet released)
|
||||||
|
* macOS: fix crash bug
|
||||||
|
|
||||||
ver 0.20.18 (2018/02/24)
|
ver 0.20.18 (2018/02/24)
|
||||||
* input
|
* input
|
||||||
|
19
src/Main.cxx
19
src/Main.cxx
@ -107,10 +107,6 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __BLOCKS__
|
|
||||||
#include <dispatch/dispatch.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
static constexpr size_t KILOBYTE = 1024;
|
static constexpr size_t KILOBYTE = 1024;
|
||||||
@ -483,21 +479,8 @@ try {
|
|||||||
daemonize_begin(options.daemon);
|
daemonize_begin(options.daemon);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __BLOCKS__
|
|
||||||
/* Runs the OS X native event loop in the main thread, and runs
|
|
||||||
the rest of mpd_main on a new thread. This lets CoreAudio receive
|
|
||||||
route change notifications (e.g. plugging or unplugging headphones).
|
|
||||||
All hardware output on OS X ultimately uses CoreAudio internally.
|
|
||||||
This must be run after forking; if dispatch is called before forking,
|
|
||||||
the child process will have a broken internal dispatch state. */
|
|
||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
||||||
exit(mpd_main_after_fork(config));
|
|
||||||
});
|
|
||||||
dispatch_main();
|
|
||||||
return EXIT_FAILURE; // unreachable, because dispatch_main never returns
|
|
||||||
#else
|
|
||||||
return mpd_main_after_fork(config);
|
return mpd_main_after_fork(config);
|
||||||
#endif
|
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
LogError(e);
|
LogError(e);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
Loading…
Reference in New Issue
Block a user