Merge pull request #15 from hamparawa/develop

Fixing a resource leak in move assignment
This commit is contained in:
Oliver Kowalke 2017-12-20 07:24:19 +01:00 committed by GitHub
commit 826f732188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 12 deletions

View File

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

View File

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