From: Michal Bloch Date: Thu, 13 Feb 2025 19:06:19 +0000 (+0100) Subject: Make sure destructors don't throw X-Git-Tag: accepted/tizen/unified/20250217.155037^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_unified;p=platform%2Fcore%2Fsystem%2Fcrash-worker.git Make sure destructors don't throw Change-Id: Ia4d3d2fa715708f04fded238305543640e78424a --- diff --git a/src/livedumper/helpers.hpp b/src/livedumper/helpers.hpp index f7f0cb5c..59e850f0 100644 --- a/src/livedumper/helpers.hpp +++ b/src/livedumper/helpers.hpp @@ -125,7 +125,16 @@ class Guardian { public: Guardian(const std::function &start, const std::function &end) : m_start(start), m_end(end) { m_start(); } - ~Guardian() { m_end(); } + ~Guardian() { + try { + m_end(); + } catch (...) { + /* Token catch just because this + * is a destructor, which can't rethrow. + * Ignore because we can rely on people + * not to use stupid guard functions. */ + } + } }; bool fileExists(const std::string &path) {