mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Correct destructor for objects owned by registry.
This commit is contained in:
@ -82,15 +82,21 @@ Foam::objectRegistry::objectRegistry
|
|||||||
|
|
||||||
Foam::objectRegistry::~objectRegistry()
|
Foam::objectRegistry::~objectRegistry()
|
||||||
{
|
{
|
||||||
|
List<regIOobject*> myObjects(size());
|
||||||
|
label nMyObjects = 0;
|
||||||
|
|
||||||
for (iterator iter = begin(); iter != end(); ++iter)
|
for (iterator iter = begin(); iter != end(); ++iter)
|
||||||
{
|
{
|
||||||
if (iter()->ownedByRegistry())
|
if (iter()->ownedByRegistry())
|
||||||
{
|
{
|
||||||
regIOobject* object = iter();
|
myObjects[nMyObjects++] = iter();
|
||||||
erase(iter);
|
|
||||||
delete object;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (label i=0; i<nMyObjects; i++)
|
||||||
|
{
|
||||||
|
checkOut(*myObjects[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -235,7 +241,7 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ inline bool Foam::regIOobject::ownedByRegistry() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::regIOobject::store()
|
inline void Foam::regIOobject::store()
|
||||||
{
|
{
|
||||||
ownedByRegistry_ = true;
|
ownedByRegistry_ = true;
|
||||||
}
|
}
|
||||||
@ -74,18 +74,18 @@ inline Type& Foam::regIOobject::store(autoPtr<Type>& atPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::regIOobject::release()
|
inline void Foam::regIOobject::release()
|
||||||
{
|
{
|
||||||
ownedByRegistry_ = false;
|
ownedByRegistry_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::regIOobject::eventNo() const
|
inline Foam::label Foam::regIOobject::eventNo() const
|
||||||
{
|
{
|
||||||
return eventNo_;
|
return eventNo_;
|
||||||
}
|
}
|
||||||
|
|
||||||
Foam::label& Foam::regIOobject::eventNo()
|
inline Foam::label& Foam::regIOobject::eventNo()
|
||||||
{
|
{
|
||||||
return eventNo_;
|
return eventNo_;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user