From: Martin Kronbichler Date: Wed, 8 Mar 2017 21:21:16 +0000 (+0100) Subject: Fix disconnect of listener. X-Git-Tag: v8.5.0-rc1~48^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db49be8ae263125a19e7bf58d447f851b2fb2769;p=dealii.git Fix disconnect of listener. --- diff --git a/include/deal.II/fe/fe_values.h b/include/deal.II/fe/fe_values.h index ce8da006e4..e34675f2f1 100644 --- a/include/deal.II/fe/fe_values.h +++ b/include/deal.II/fe/fe_values.h @@ -2628,12 +2628,21 @@ protected: /** * A signal connection we use to ensure we get informed whenever the - * triangulation changes. We need to know about that because it invalidates - * all cell iterators and, as part of that, the 'present_cell' iterator we - * keep around between subsequent calls to reinit() in order to compute the - * cell similarity. + * triangulation changes by refinement. We need to know about that because + * it invalidates all cell iterators and, as part of that, the + * 'present_cell' iterator we keep around between subsequent calls to + * reinit() in order to compute the cell similarity. */ - boost::signals2::connection tria_listener; + boost::signals2::connection tria_listener_refinement; + + /** + * A signal connection we use to ensure we get informed whenever the + * triangulation changes by mesh transformations. We need to know about that + * because it invalidates all cell iterators and, as part of that, the + * 'present_cell' iterator we keep around between subsequent calls to + * reinit() in order to compute the cell similarity. + */ + boost::signals2::connection tria_listener_mesh_transform; /** * A function that is connected to the triangulation in order to reset the diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index f94e2cc106..964b81365f 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -2275,7 +2275,8 @@ FEValuesBase::FEValuesBase (const unsigned int n_q_points, template FEValuesBase::~FEValuesBase () { - tria_listener.disconnect (); + tria_listener_refinement.disconnect (); + tria_listener_mesh_transform.disconnect (); } @@ -3458,7 +3459,8 @@ FEValuesBase< dim, spacedim >::invalidate_present_cell () // so delete the present cell and // disconnect from the signal we have with // it - tria_listener.disconnect (); + tria_listener_refinement.disconnect (); + tria_listener_mesh_transform.disconnect (); present_cell.reset (); } @@ -3479,12 +3481,15 @@ maybe_invalidate_previous_present_cell (const typename Triangulationget_triangulation().signals.any_change.connect (std_cxx11::bind (&FEValuesBase::invalidate_present_cell, std_cxx11::ref(static_cast&>(*this)))); + tria_listener_mesh_transform = + cell->get_triangulation().signals.mesh_movement.connect + (std_cxx11::bind (&FEValuesBase::invalidate_present_cell, + std_cxx11::ref(static_cast&>(*this)))); } } else @@ -3492,12 +3497,12 @@ maybe_invalidate_previous_present_cell (const typename Triangulationget_triangulation().signals.mesh_movement.connect + tria_listener_refinement = + cell->get_triangulation().signals.post_refinement.connect (std_cxx11::bind (&FEValuesBase::invalidate_present_cell, std_cxx11::ref(static_cast&>(*this)))); - tria_listener = - cell->get_triangulation().signals.post_refinement.connect + tria_listener_mesh_transform = + cell->get_triangulation().signals.mesh_movement.connect (std_cxx11::bind (&FEValuesBase::invalidate_present_cell, std_cxx11::ref(static_cast&>(*this)))); }