From a9841a9197e79461a3ed3a0efc79fca7d78f1a22 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 1 Mar 2019 14:29:35 +0100 Subject: [PATCH] Defer: ensure not to throw any exceptions out of a destructor refs #6989 --- lib/base/defer.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: -- 2.49.0