From c79611aa3ee3d5782a7e2c42e0895dbf50cce355 Mon Sep 17 00:00:00 2001 From: Roland Haas Date: Tue, 29 May 2012 10:19:53 -0700 Subject: CarpetLib: add self-copy logic to classes with pointer members right now disabled by an assert --- Carpet/CarpetLib/src/bintree.cc | 3 +++ Carpet/CarpetLib/src/fulltree.cc | 3 +++ Carpet/CarpetLib/src/prolongate_3d_real8_eno.F90 | 2 +- Carpet/CarpetLib/src/region.cc | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Carpet/CarpetLib/src/bintree.cc b/Carpet/CarpetLib/src/bintree.cc index db3b27e1c..59c1e0a84 100644 --- a/Carpet/CarpetLib/src/bintree.cc +++ b/Carpet/CarpetLib/src/bintree.cc @@ -75,6 +75,9 @@ template bintree & bintree::operator= (bintree const & t) { + assert (&t != this); // subtree delet handling is currently incorrect in this case + if (&t == this) return *this; // nothing to do + assert (invariant()); if (is_branch()) { for (int i=0; i<2; ++i) { diff --git a/Carpet/CarpetLib/src/fulltree.cc b/Carpet/CarpetLib/src/fulltree.cc index d482691cf..202d59b77 100644 --- a/Carpet/CarpetLib/src/fulltree.cc +++ b/Carpet/CarpetLib/src/fulltree.cc @@ -77,6 +77,9 @@ template fulltree & fulltree::operator= (fulltree const & t) { + assert (&t != this); // subtree delet handling is currently incorrect in this case + if (&t == this) return *this; // nothing to do + assert (invariant()); if (is_branch()) { for (size_t i=0; i