]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Suppress a segmentation fault when destroying the global deallog object that we get...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 17 Oct 2008 22:43:34 +0000 (22:43 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 17 Oct 2008 22:43:34 +0000 (22:43 +0000)
git-svn-id: https://svn.dealii.org/trunk@17269 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/log.cc

index 64609a0d5a54c395f080cca10d6e1427592350bb..1c489db09846fbf4adb35148fe7fe0fd621fe62a 100644 (file)
@@ -67,6 +67,21 @@ LogStream::~LogStream()
 {
   if (old_cerr)
     std::cerr.rdbuf(old_cerr);
+
+                                  // on some systems, destroying the
+                                  // outstreams objects of deallog
+                                  // triggers some sort of memory
+                                  // corruption, in particular when
+                                  // we also link with Trilinos;
+                                  // since this happens at the very
+                                  // end of the program, we take the
+                                  // liberty to simply not do it by
+                                  // putting that object into a
+                                  // deliberate memory leak and
+                                  // instead destroying an empty
+                                  // object
+  if (this == &deallog)
+    (new stream_map_type())->swap (outstreams);
 }
 
 

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.