From a3e7a154447e5b6c0bd040901622d17606a2e6de Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 2 Oct 2017 10:33:57 -0600 Subject: [PATCH] Make sure a destructor does not throw any exceptions. --- source/base/logstream.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/base/logstream.cc b/source/base/logstream.cc index eea5f82edd..5040fde7e4 100644 --- a/source/base/logstream.cc +++ b/source/base/logstream.cc @@ -59,7 +59,17 @@ LogStream::Prefix::Prefix(const std::string &text, LogStream::Prefix::~Prefix() { - stream->pop(); + // destructors may not throw exceptions. if the pop() function + // actually does throw one, then ignore it + try + { + stream->pop(); + } + catch (...) + { + AssertNothrow (false, + ExcMessage("An exception occurred in LogStream::Prefix::~Prefix.")); + } } -- 2.39.5