From f14637a96594e0afb280ce0aa81a57620b522660 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 24 May 2018 13:29:11 +0100 Subject: [PATCH] regIOobject: Avoid segmentation fault when destroying objectRegistry with debug on --- src/OpenFOAM/db/regIOobject/regIOobject.C | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.C b/src/OpenFOAM/db/regIOobject/regIOobject.C index 0b6d4e26b..bf85721d2 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.C +++ b/src/OpenFOAM/db/regIOobject/regIOobject.C @@ -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();