From: Arnaud Giersch Date: Fri, 26 Aug 2022 13:23:21 +0000 (+0200) Subject: Don't throw an exception from destructor. X-Git-Tag: v3.32~47 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/652f3e76e7c497465634ed4ddb9547e160b3abbf Don't throw an exception from destructor. boost::circular_buffer_space_optimized::pop_back() may throw std::bad_alloc --- diff --git a/src/kernel/activity/MailboxImpl.cpp b/src/kernel/activity/MailboxImpl.cpp index 7ee160c332..b73838178e 100644 --- a/src/kernel/activity/MailboxImpl.cpp +++ b/src/kernel/activity/MailboxImpl.cpp @@ -21,7 +21,11 @@ unsigned MailboxImpl::next_id_ = 0; MailboxImpl::~MailboxImpl() { - clear(false); + try { + clear(false); + } catch (const std::bad_alloc& ba) { + XBT_ERROR("MailboxImpl::clear() failure: %s", ba.what()); + } set_receiver(nullptr); }