]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make sure a destructor does not throw any exceptions. 5181/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 2 Oct 2017 16:33:57 +0000 (10:33 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 2 Oct 2017 16:34:49 +0000 (10:34 -0600)
source/base/logstream.cc

index eea5f82edd1aae7f3a6363120874557679eb0a7b..5040fde7e46782b23989925ca3cd703c9924bbca 100644 (file)
@@ -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."));
+    }
 }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.