mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2011, 2015-2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011, 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user