From 032e95ab74b1a2a9a4cc3f9c070b764b89963ce2 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch <bernd@iws.uni-stuttgart.de> Date: Tue, 26 Feb 2013 12:22:39 +0000 Subject: [PATCH] Bugfix: It is wrong to use a shared_ptr for the TimeManager in OneModelProblem, since the object can be owned by a different class. This leads to a segfault at the end of test_transport. Therefore, a raw pointer is taken for the moment. We should carefully rethink this in general after the release. Discussed with Markus. git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10278 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- dumux/decoupled/common/onemodelproblem.hh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dumux/decoupled/common/onemodelproblem.hh b/dumux/decoupled/common/onemodelproblem.hh index 67779909fd..fb883ad833 100644 --- a/dumux/decoupled/common/onemodelproblem.hh +++ b/dumux/decoupled/common/onemodelproblem.hh @@ -107,7 +107,8 @@ public: } } - timeManager_ = Dune::make_shared<TimeManager>(verbose); + timeManager_ = new TimeManager(verbose); + newTimeManager_ = true; model_ = Dune::make_shared<Model>(asImp_()) ; } @@ -122,6 +123,7 @@ public: bboxMin_(std::numeric_limits<double>::max()), bboxMax_(-std::numeric_limits<double>::max()), timeManager_(&timeManager), + newTimeManager_(false), variables_(gridView), outputInterval_(1) { @@ -134,10 +136,17 @@ public: bboxMax_[i] = std::max(bboxMax_[i], vIt->geometry().center()[i]); } } - + model_ = Dune::make_shared<Model>(asImp_()) ; } + //! Destructor + ~OneModelProblem() + { + if (newTimeManager_) + delete timeManager_; + } + /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary segment. @@ -626,7 +635,8 @@ private: GlobalPosition bboxMin_; GlobalPosition bboxMax_; - Dune::shared_ptr<TimeManager> timeManager_; + TimeManager *timeManager_; + bool newTimeManager_; Variables variables_; -- GitLab