Skip to content

Commit

Permalink
Ensure flush callback gets called in move-assign operator (#3232)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oipo authored Oct 30, 2024
1 parent 16e0d2e commit b6da594
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/spdlog/details/thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ struct async_msg : log_msg_buffer {
flush_callback(std::move(other.flush_callback)) {
other.flush_callback = nullptr;
}

async_msg &operator=(async_msg &&other) SPDLOG_NOEXCEPT {
*static_cast<log_msg_buffer *>(this) = static_cast<log_msg_buffer&&>(other);
msg_type = other.msg_type;
worker_ptr = std::move(other.worker_ptr);
flush_callback = std::move(other.flush_callback);
other.flush_callback = nullptr;
std::swap(flush_callback, other.flush_callback);
return *this;
}

Expand Down

0 comments on commit b6da594

Please sign in to comment.