0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-02-18 09:40:12 +01:00

ircd::ctx: Fix move assignment semantics.

This commit is contained in:
Jason Volk 2018-11-13 17:45:08 -08:00
parent 5b0af2f509
commit 8cbb354c64
3 changed files with 10 additions and 6 deletions

View file

@ -103,9 +103,10 @@ ircd::ctx::list::operator=(list &&o)
noexcept
{
this->~list();
std::swap(head, o.head);
std::swap(tail, o.tail);
assert(!o.head && !o.tail);
head = std::move(o.head);
tail = std::move(o.tail);
o.head = nullptr;
o.tail = nullptr;
return *this;
}

View file

@ -67,7 +67,8 @@ ircd::ctx::mutex::operator=(mutex &&o)
noexcept
{
this->~mutex();
std::swap(m, o.m);
m = std::move(o.m);
o.m = false;
return *this;
}

View file

@ -97,8 +97,10 @@ ircd::ctx::shared_mutex::operator=(shared_mutex &&o)
noexcept
{
this->~shared_mutex();
std::swap(u, o.u);
std::swap(s, o.s);
u = std::move(o.u);
s = std::move(o.s);
o.u = false;
o.s = 0;
return *this;
}