]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use RefCount::dereference() correctly in move assignment
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 21 Feb 2015 12:29:16 +0000 (04:29 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 21 Feb 2015 12:29:16 +0000 (04:29 -0800)
The dereference() member is actually an update operation on the stored
pointer. We can and should just use it to steal the others pointer
instead of using it on our own then stealing.

src/base/RefCount.h

index 32ef2db6751d536362b5562bf6f8d18fbd5c9f80..18b6cfb9889836021095ccc703d4a5c31f62b8a0 100644 (file)
@@ -54,8 +54,7 @@ public:
 
     RefCount& operator = (RefCount&& p) {
         if (this != &p) {
-            dereference(p_);
-            p_ = std::move(p.p_);
+            dereference(p.p_);
             p.p_ = NULL;
         }
         return *this;