Fixing a resource leak in move assignment

Signed-off-by: Saliya Hamparawa <hamparawa@gmail.com>
This commit is contained in:
Saliya Hamparawa 2017-12-20 11:09:38 +05:30
parent 40cbfe5c01
commit 7a702c4e86
2 changed files with 2 additions and 4 deletions

View File

@ -56,8 +56,7 @@ public:
pull_coroutine & operator=( pull_coroutine && other) noexcept {
if ( this == & other) return * this;
cb_ = other.cb_;
other.cb_ = nullptr;
std::swap(cb_, other.cb_);
return * this;
}

View File

@ -54,8 +54,7 @@ public:
push_coroutine & operator=( push_coroutine && other) noexcept {
if ( this == & other) return * this;
cb_ = other.cb_;
other.cb_ = nullptr;
std::swap(cb_, other.cb_);
return * this;
}