From: Alexander A. Klimov Date: Fri, 1 Mar 2019 13:29:35 +0000 (+0100) Subject: Defer: ensure not to throw any exceptions out of a destructor X-Git-Tag: v2.11.0-rc1~201^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9841a9197e79461a3ed3a0efc79fca7d78f1a22;p=icinga2 Defer: ensure not to throw any exceptions out of a destructor refs #6989 --- diff --git a/lib/base/defer.hpp b/lib/base/defer.hpp index 33cc197db..9290c92b9 100644 --- a/lib/base/defer.hpp +++ b/lib/base/defer.hpp @@ -30,7 +30,11 @@ public: inline ~Defer() { - m_Func(); + try { + m_Func(); + } catch (...) { + // https://stackoverflow.com/questions/130117/throwing-exceptions-out-of-a-destructor + } } private: