Skip to content

Commit

Permalink
fix(coro): fix awaitable/task move assignment, again
Browse files Browse the repository at this point in the history
  • Loading branch information
Mishura4 committed Jul 15, 2024
1 parent 1899e6a commit 6f06990
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/dpp/coro/awaitable.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ class awaitable : public basic_awaitable<awaitable<T>> {
* @return *this
*/
awaitable& operator=(awaitable&& rhs) noexcept {
abandon();
state_ptr = std::exchange(rhs.state_ptr, nullptr);
return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/coro/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ class [[nodiscard("dpp::task cancels itself on destruction. use co_await on it,
* @param other Task to move the handle from
*/
task &operator=(task &&other) noexcept {
awaitable<R>::operator=(std::move(other));
cleanup();
handle = std::exchange(other.handle, nullptr);
awaitable<R>::operator=(std::move(other));
return *this;
}

Expand Down

0 comments on commit 6f06990

Please sign in to comment.