summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-08-15 11:07:33 -0700
committerandroid code review <noreply-gerritcodereview@google.com>2012-08-15 11:07:34 -0700
commitf4aee7bd601621d648044a0f918247fd81b6190a (patch)
tree5caa522ea6cc15a144382cf80455b8fa8e1f105b
parent1c684ed1b5ac92ae473db5718627405367eb1766 (diff)
parentc2cbc7df84951541b29200c3a6ade3163fb815ae (diff)
downloadexternal_chromium-f4aee7bd601621d648044a0f918247fd81b6190a.zip
external_chromium-f4aee7bd601621d648044a0f918247fd81b6190a.tar.gz
external_chromium-f4aee7bd601621d648044a0f918247fd81b6190a.tar.bz2
Merge "back port upstream patch"
-rw-r--r--base/memory/ref_counted.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/base/memory/ref_counted.h b/base/memory/ref_counted.h
index 1207ed4..e35264b 100644
--- a/base/memory/ref_counted.h
+++ b/base/memory/ref_counted.h
@@ -260,9 +260,10 @@ class scoped_refptr {
// AddRef first so that self assignment should work
if (p)
p->AddRef();
- if (ptr_ )
- ptr_ ->Release();
+ T* old_ptr = ptr_;
ptr_ = p;
+ if (old_ptr)
+ old_ptr ->Release();
return *this;
}