Commit 805cc595 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: force clearing of Time objectRegistry on destruction (#1276)

- the objectRegistry destructor seems to be called too late.
  Explicitly clear the objectRegistry within the Time destructor to
  ensure that it always happens.
parent eea4eb89
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -727,6 +727,9 @@ Foam::Time::~Time()
// Clean up profiling
profiling::stop(*this);
// Ensure all owned objects are also cleaned up now
objectRegistry::clear();
}
......
......@@ -323,6 +323,14 @@ void Foam::objectRegistry::clear()
if (ptr && ptr->ownedByRegistry())
{
// TBD: may wish to have ptr->clearWatches();
if (objectRegistry::debug)
{
Pout<< "objectRegistry::clear : " << ptr->name()
<< " watches :" << flatOutput(ptr->watchIndices()) << nl;
}
delete ptr;
}
}
......@@ -350,6 +358,7 @@ bool Foam::objectRegistry::erase(const iterator& iter)
if (ptr && ptr->ownedByRegistry())
{
// TBD: may wish to have ptr->clearWatches();
delete ptr;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment