diff --git a/src/atlas/field/detail/FieldImpl.cc b/src/atlas/field/detail/FieldImpl.cc index 78d929f23..3d655926d 100644 --- a/src/atlas/field/detail/FieldImpl.cc +++ b/src/atlas/field/detail/FieldImpl.cc @@ -94,6 +94,9 @@ FieldImpl::FieldImpl(const std::string& name, array::Array* array) } FieldImpl::~FieldImpl() { + for (FieldObserver* observer : field_observers_) { + observer->onFieldDestruction(*this); + } array_->detach(); if (array_->owners() == 0) { for (auto& f : callback_on_destruction_) { diff --git a/src/atlas/field/detail/FieldImpl.h b/src/atlas/field/detail/FieldImpl.h index cdd9c308f..24af72d2c 100644 --- a/src/atlas/field/detail/FieldImpl.h +++ b/src/atlas/field/detail/FieldImpl.h @@ -257,7 +257,8 @@ class FieldObserver { } } - virtual void onFieldRename(FieldImpl&) = 0; + virtual void onFieldRename(FieldImpl&) {} + virtual void onFieldDestruction(FieldImpl&) {} }; //----------------------------------------------------------------------------------------------------------------------