BUG: registerCopy may fail for copy construct of regIOobject

- checkIn() was incorrectly conditional on the register state of the
  source object.

Partial patch from .org commit 6dc48b62d948
This commit is contained in:
Mark Olesen
2019-01-23 13:25:18 +01:00
parent 51bac480e1
commit 97ac486b58

View File

@ -96,9 +96,12 @@ Foam::regIOobject::regIOobject(const regIOobject& rio, bool registerCopy)
eventNo_(db().getEvent()), eventNo_(db().getEvent()),
isPtr_(nullptr) isPtr_(nullptr)
{ {
if (registerCopy && rio.registered_) if (registerCopy)
{
if (rio.registered_)
{ {
const_cast<regIOobject&>(rio).checkOut(); const_cast<regIOobject&>(rio).checkOut();
}
checkIn(); checkIn();
} }
} }