Commit 2ab03a09 authored by Max Kellermann's avatar Max Kellermann

util/ScopeExit: allow the function to throw

Fixes crash inside AtScopeExit() in the WASAPI output plugin. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1759
parent 2fa8c7d2
......@@ -47,7 +47,11 @@ public:
src.enabled = false;
}
~ScopeExitGuard() {
/* destructors are "noexcept" by default; this explicit
"noexcept" declaration allows the destructor to throw if
the function can throw; without this, a throwing function
would std::terminate() */
~ScopeExitGuard() noexcept(noexcept(F::operator()())) {
if (enabled)
F::operator()();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment