diff --git a/CHANGES b/CHANGES index 0c3e968940..ffc08e36bc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ + +4.1.0-dev.708 | 2021-06-07 09:22:36 +0200 + + * Improve assignment operators for IntrusivePtr. (Dominik Charousset, Corelight) + + * Fix docs for `ProcStats`: `mem` is in bytes, not KB. (Arne Welzel, Corelight) + 4.1.0-dev.704 | 2021-06-04 08:29:18 -0700 * Add deprecated headers for UDP and ICMP analyzers (Tim Wojtulewicz, Corelight) diff --git a/VERSION b/VERSION index b46f9cccca..980b1ff835 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.1.0-dev.704 +4.1.0-dev.708 diff --git a/src/IntrusivePtr.h b/src/IntrusivePtr.h index 7ad37031c8..cb09e9c9f8 100644 --- a/src/IntrusivePtr.h +++ b/src/IntrusivePtr.h @@ -137,12 +137,29 @@ public: return std::exchange(ptr_, nullptr); } - IntrusivePtr& operator=(IntrusivePtr other) noexcept + IntrusivePtr& operator=(const IntrusivePtr& other) noexcept + { + IntrusivePtr tmp{other}; + swap(tmp); + return *this; + } + + IntrusivePtr& operator=(IntrusivePtr&& other) noexcept { swap(other); return *this; } + IntrusivePtr& operator=(std::nullptr_t) noexcept + { + if ( ptr_ ) + { + Unref(ptr_); + ptr_ = nullptr; + } + return *this; + } + pointer get() const noexcept { return ptr_;