util/ScopeExit: allow the function to throw
Fixes crash inside AtScopeExit() in the WASAPI output plugin. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1759
This commit is contained in:
parent
2fa8c7d2db
commit
2ab03a0914
@ -47,7 +47,11 @@ public:
|
|||||||
src.enabled = false;
|
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)
|
if (enabled)
|
||||||
F::operator()();
|
F::operator()();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user