From: Martin Kronbichler Date: Thu, 12 Apr 2018 08:10:46 +0000 (+0200) Subject: Fix signal handling of transfinite interpolation once cleared. X-Git-Tag: v9.0.0-rc1~191^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6227%2Fhead;p=dealii.git Fix signal handling of transfinite interpolation once cleared. --- 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