Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment