diff options
author | Max Kellermann <max@musicpd.org> | 2018-08-01 20:14:31 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-08-01 20:14:31 +0200 |
commit | 6ffbb151a0f4ae8d52b6c28a5c45fc2c3807f723 (patch) | |
tree | c90f6a7cc4f4080ab0ea1bf4250e14d31463535a /src/Main.cxx | |
parent | 271e49db5d2d85ad1ee7deb7cd1b3d69d4dc2f3e (diff) |
Main: move log_deinit() call to mpd_main()
Deinitialize the logging library after the last exception handler,
because that one could still need it.
Use `AtScopeExit()` to ensure it's always called, even if an exception
was thrown.
Diffstat (limited to 'src/Main.cxx')
-rw-r--r-- | src/Main.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Main.cxx b/src/Main.cxx index 009ed9a00..8e7fc1236 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -59,6 +59,7 @@ #include "config/Option.hxx" #include "config/Domain.hxx" #include "util/RuntimeError.hxx" +#include "util/ScopeExit.hxx" #ifdef ENABLE_DAEMON #include "unix/Daemon.hxx" @@ -534,6 +535,8 @@ static inline #endif int mpd_main(int argc, char *argv[]) { + AtScopeExit() { log_deinit(); }; + try { return MainOrThrow(argc, argv); } catch (const std::exception &e) { @@ -717,8 +720,6 @@ try { IcuFinish(); - log_deinit(); - return EXIT_SUCCESS; } catch (const std::exception &e) { LogError(e); |