regIOobject: Avoid segmentation fault when destroying objectRegistry with debug on

This commit is contained in:
Henry Weller
2018-05-24 14:41:04 +01:00
parent 51813b7ca6
commit c8ebb54ff5

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -147,14 +147,21 @@ Foam::regIOobject::~regIOobject()
{
if (objectRegistry::debug)
{
Pout<< "Destroying regIOobject called " << name()
<< " of type " << type()
<< " in directory " << path()
<< endl;
if (this == &db())
{
Pout<< "Destroying objectRegistry " << name()
<< " in directory " << rootPath()/caseName()/instance()
<< endl;
}
else
{
Pout<< "Destroying regIOobject " << name()
<< " in directory " << path()
<< endl;
}
}
// Check out of objectRegistry if not owned by the registry
if (!ownedByRegistry_)
{
checkOut();