From f85ce5559db22e0eaa2942b4a2770241f8b07357 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 7 Jun 2016 08:53:07 -0500 Subject: [PATCH] First call the signal, then destroy the object. --- include/deal.II/grid/tria.h | 6 ++++++ source/grid/tria.cc | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 7b9684280c..9608ad3986 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -2023,6 +2023,12 @@ public: * is called. This signal is also triggered when loading a triangulation * from an archive via Triangulation::load() as the previous content of * the triangulation is first destroyed. + * + * The signal is triggered before the data structures of the + * triangulation are destroyed. In other words, the functions + * attached to this signal get a last look at the triangulation, + * for example to save information stored as part of the + * triangulation. */ boost::signals2::signal clear; diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 4b76e7b8d5..31b117337e 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -9024,13 +9024,13 @@ Triangulation::~Triangulation () template void Triangulation::clear () { - // clear all content of the triangulation... + // notify listeners that the triangulation is going down... + signals.clear(); + + // ...and then actually clear all content of it clear_despite_subscriptions(); periodic_face_pairs_level_0.clear(); periodic_face_map.clear(); - - // ...and then notify listeners to it - signals.clear(); } -- 2.39.5