From 9fb2b2fc57486b18c4f531e0883b0853c4a1f439 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 17 Oct 2008 22:43:34 +0000 Subject: [PATCH] Suppress a segmentation fault when destroying the global deallog object that we get when linking with Trilinos. We pay for this by creating a small memory leak, but that's still better. git-svn-id: https://svn.dealii.org/trunk@17269 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/log.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/deal.II/base/source/log.cc b/deal.II/base/source/log.cc index 64609a0d5a..1c489db098 100644 --- a/deal.II/base/source/log.cc +++ b/deal.II/base/source/log.cc @@ -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); } -- 2.39.5