Ensure flush callback gets called in move-assign operator (#3232)
Some checks failed
ci / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }}) (map[asan:OFF build_type:Debug compiler:clang cppstd:17 version:12]) (push) Has been cancelled
ci / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }}) (map[asan:OFF build_type:Release compiler:clang cppstd:20 version:15]) (push) Has been cancelled
ci / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }}) (map[build_type:Debug compiler:gcc cppstd:20 version:11]) (push) Has been cancelled
ci / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }}) (map[build_type:Release compiler:gcc cppstd:11 version:7]) (push) Has been cancelled
ci / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }}) (map[build_type:Release compiler:gcc cppstd:17 version:9]) (push) Has been cancelled
ci / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }}) (map[build_type:Release compiler:gcc cppstd:20 version:12]) (push) Has been cancelled
ci / OS X Clang (C++11, Release) (push) Has been cancelled

This commit is contained in:
Michael de Lang 2024-10-30 16:55:45 +01:00 committed by GitHub
parent 16e0d2e77c
commit b6da59447f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
} }