Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't throw an exception from destructor.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 26 Aug 2022 13:23:21 +0000 (15:23 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 26 Aug 2022 13:23:21 +0000 (15:23 +0200)
boost::circular_buffer_space_optimized::pop_back() may throw std::bad_alloc

src/kernel/activity/MailboxImpl.cpp

index 7ee160c..b738381 100644 (file)
@@ -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);
 }