Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/intrusive_ptr.h

Issue 29557721: Noissue - Fix intrusive_ptr<> operator= (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Sept. 27, 2017, 5:25 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/intrusive_ptr.h
===================================================================
--- a/compiled/intrusive_ptr.h
+++ b/compiled/intrusive_ptr.h
@@ -91,25 +91,27 @@
}
~intrusive_ptr()
{
if (mPointer)
mPointer->ReleaseRef();
}
- intrusive_ptr& operator=(intrusive_ptr& other)
+ intrusive_ptr& operator=(const intrusive_ptr& other)
hub 2017/09/27 17:30:03 it should be const & here.
{
- intrusive_ptr(other).swap(*this);
+ if (this != &other)
hub 2017/09/27 17:30:03 we shall insure that the self assignment is a noop
+ intrusive_ptr(other).swap(*this);
return *this;
}
intrusive_ptr& operator=(intrusive_ptr&& other)
{
- intrusive_ptr(std::move(other)).swap(*this);
+ if (this != &other)
hub 2017/09/27 17:30:03 same here.
+ intrusive_ptr(std::move(other)).swap(*this);
return *this;
}
intrusive_ptr& operator=(T* other)
{
intrusive_ptr(other).swap(*this);
return *this;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld