From 4fdd8684e716080dd66133aab2fdd6315d4ed561 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Thu, 12 Apr 2018 10:10:46 +0200 Subject: [PATCH] Fix signal handling of transfinite interpolation once cleared. --- include/deal.II/grid/manifold_lib.h | 11 +++++++++++ source/grid/manifold_lib.cc | 13 +++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/deal.II/grid/manifold_lib.h b/include/deal.II/grid/manifold_lib.h index a81d837c07..e2679fa140 100644 --- a/include/deal.II/grid/manifold_lib.h +++ b/include/deal.II/grid/manifold_lib.h @@ -831,6 +831,11 @@ public: */ TransfiniteInterpolationManifold(); + /** + * Destructor. + */ + ~TransfiniteInterpolationManifold(); + /** * Make a clone of this Manifold object. */ @@ -996,6 +1001,12 @@ private: * use a FlatManifold description. */ FlatManifold chart_manifold; + + /** + * The connection to Triangulation::signals::clear that must be reset once + * this class goes out of scope. + */ + boost::signals2::connection clear_signal; }; DEAL_II_NAMESPACE_CLOSE diff --git a/source/grid/manifold_lib.cc b/source/grid/manifold_lib.cc index ea5f129b64..ab2178a473 100644 --- a/source/grid/manifold_lib.cc +++ b/source/grid/manifold_lib.cc @@ -1347,6 +1347,15 @@ TransfiniteInterpolationManifold::TransfiniteInterpolationManifold +template +TransfiniteInterpolationManifold::~TransfiniteInterpolationManifold() +{ + if (clear_signal.connected()) + clear_signal.disconnect(); +} + + + template std::unique_ptr > TransfiniteInterpolationManifold::clone() const @@ -1366,8 +1375,8 @@ TransfiniteInterpolationManifold { this->triangulation = &triangulation; // in case the triangulatoin is cleared, remove the pointers by a signal - triangulation.signals.clear.connect - ([&]() -> void {this->triangulation = nullptr; this->level_coarse = -1;}); + clear_signal = triangulation.signals.clear.connect + ([&]() -> void {this->triangulation = nullptr; this->level_coarse = -1;}); level_coarse = triangulation.last()->level(); coarse_cell_is_flat.resize(triangulation.n_cells(level_coarse), false); typename Triangulation::active_cell_iterator -- 2.39.5