From 2599c6f179fa97cf58284ed387963177665b56f6 Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Wed, 23 Oct 2024 11:26:34 +0200 Subject: [PATCH] Do not throw in destructor during unwinding --- include/aspect/plugins.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/aspect/plugins.h b/include/aspect/plugins.h index ec0e7fec888..ec851b4b52f 100644 --- a/include/aspect/plugins.h +++ b/include/aspect/plugins.h @@ -294,7 +294,16 @@ namespace aspect template ManagerBase::~ManagerBase() { - Assert (plugin_names.size() == plugin_objects.size(), ExcInternalError()); + // only check and throw if we are not unwinding the stack due + // to an active exception +#ifdef DEAL_II_HAVE_CXX17 + if (std::uncaught_exceptions() == 0) +#else + if (std::uncaught_exception() == false) +#endif + { + Assert (plugin_names.size() == plugin_objects.size(), ExcInternalError()); + } }