Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
2ce1ca48
Commit
2ce1ca48
authored
6 years ago
by
mattijs
Committed by
Andrew Heather
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
BUG: objectRegistry: two-pass deletion. See #1276.
parent
5dd6a04f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/OpenFOAM/db/objectRegistry/objectRegistry.C
+18
-2
18 additions, 2 deletions
src/OpenFOAM/db/objectRegistry/objectRegistry.C
with
18 additions
and
2 deletions
src/OpenFOAM/db/objectRegistry/objectRegistry.C
+
18
−
2
View file @
2ce1ca48
...
...
@@ -334,6 +334,14 @@ bool Foam::objectRegistry::checkOut(const word& key) const
void
Foam
::
objectRegistry
::
clear
()
{
// Free anything owned by the registry
// This needs to be done in two stages:
// - collect objects-to-be-removed
// - actually delete objects
// since the destructor of the regIOobject will actually delete its
// entry from the objectRegistry which messes up the iterator.
DynamicList
<
regIOobject
*>
owned
;
for
(
iterator
iter
=
begin
();
iter
!=
end
();
++
iter
)
{
regIOobject
*
ptr
=
iter
.
val
();
...
...
@@ -341,17 +349,25 @@ 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
;
owned
.
append
(
ptr
);
}
}
for
(
regIOobject
*
objectPtr
:
owned
)
{
// Make sure that the destructor of the regIOobject does a checkout
objectPtr
->
release
();
delete
objectPtr
;
}
HashTable
<
regIOobject
*>::
clear
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment