Skip to content

Commit b6da594

Browse files
authored
Ensure flush callback gets called in move-assign operator (#3232)
1 parent 16e0d2e commit b6da594

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/spdlog/details/thread_pool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ struct async_msg : log_msg_buffer {
4949
flush_callback(std::move(other.flush_callback)) {
5050
other.flush_callback = nullptr;
5151
}
52+
5253
async_msg &operator=(async_msg &&other) SPDLOG_NOEXCEPT {
5354
*static_cast<log_msg_buffer *>(this) = static_cast<log_msg_buffer&&>(other);
5455
msg_type = other.msg_type;
5556
worker_ptr = std::move(other.worker_ptr);
56-
flush_callback = std::move(other.flush_callback);
57-
other.flush_callback = nullptr;
57+
std::swap(flush_callback, other.flush_callback);
5858
return *this;
5959
}
6060

0 commit comments

Comments
 (0)