Navigation Menu

Skip to content

Commit

Permalink
Fixed|libcore: Potential crash when copying records
Browse files Browse the repository at this point in the history
Record’s move assignment operator wasn’t updating the private back
pointer.
  • Loading branch information
skyjake committed Feb 14, 2017
1 parent 64a54b0 commit 001060b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doomsday/sdk/libcore/src/data/record.cpp
Expand Up @@ -415,6 +415,7 @@ Record::Record(Record &&moved)
, d(std::move(moved.d))
{
DENG2_ASSERT(moved.d.isNull());

d->thisPublic = this;
}

Expand All @@ -426,7 +427,6 @@ Record::~Record()
// to the record prior to deletion.
DENG2_FOR_AUDIENCE2(Deletion, i) i->recordBeingDeleted(*this);

DENG2_GUARD(d);
clear();
}
}
Expand Down Expand Up @@ -467,6 +467,7 @@ Record &Record::operator = (Record const &other)
Record &Record::operator = (Record &&moved)
{
d = std::move(moved.d);
d->thisPublic = this;
return *this;
}

Expand Down

0 comments on commit 001060b

Please sign in to comment.