Ensure flush callback gets called in move-assign operator (#3232)

pull/3236/head
Michael de Lang 10 months ago committed by GitHub
parent 16e0d2e77c
commit b6da59447f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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

Loading…
Cancel
Save