Merge remote-tracking branch 'origin/topic/neverlord/coverity'

* origin/topic/neverlord/coverity:
  Improve assignment operators for IntrusivePtr
This commit is contained in:
Robin Sommer 2021-06-07 09:22:36 +02:00
commit ba0a4fe9cf
3 changed files with 26 additions and 2 deletions

View file

@ -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 4.1.0-dev.704 | 2021-06-04 08:29:18 -0700
* Add deprecated headers for UDP and ICMP analyzers (Tim Wojtulewicz, Corelight) * Add deprecated headers for UDP and ICMP analyzers (Tim Wojtulewicz, Corelight)

View file

@ -1 +1 @@
4.1.0-dev.704 4.1.0-dev.708

View file

@ -137,12 +137,29 @@ public:
return std::exchange(ptr_, nullptr); 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); swap(other);
return *this; return *this;
} }
IntrusivePtr& operator=(std::nullptr_t) noexcept
{
if ( ptr_ )
{
Unref(ptr_);
ptr_ = nullptr;
}
return *this;
}
pointer get() const noexcept pointer get() const noexcept
{ {
return ptr_; return ptr_;