diff options
author | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-24 09:13:09 +0000 |
---|---|---|
committer | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-24 09:13:09 +0000 |
commit | 7f18b7c4d80a1ad4407d6a71c4a52452e0bcf1e1 (patch) | |
tree | 889a5fef4234b6c4cb755f9c4f7e3e882510e9a3 /base/memory | |
parent | 5c68b0696153548be9f374724f89a6b007d00f2a (diff) | |
download | chromium_src-7f18b7c4d80a1ad4407d6a71c4a52452e0bcf1e1.zip chromium_src-7f18b7c4d80a1ad4407d6a71c4a52452e0bcf1e1.tar.gz chromium_src-7f18b7c4d80a1ad4407d6a71c4a52452e0bcf1e1.tar.bz2 |
Fix weak_ptr's operator* implementation.
This looks like a typo. Seems that nobody has tried to use this operator before.
BUG=none
TEST=WeakPtrTest.Dereference
R=darin@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9452021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123456 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/memory')
-rw-r--r-- | base/memory/weak_ptr.h | 4 | ||||
-rw-r--r-- | base/memory/weak_ptr_unittest.cc | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/base/memory/weak_ptr.h b/base/memory/weak_ptr.h index bdfc308..c0ba7f5 100644 --- a/base/memory/weak_ptr.h +++ b/base/memory/weak_ptr.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -173,7 +173,7 @@ class WeakPtr : public internal::WeakPtrBase { T* operator*() const { DCHECK(get() != NULL); - return *get(); + return get(); } T* operator->() const { DCHECK(get() != NULL); diff --git a/base/memory/weak_ptr_unittest.cc b/base/memory/weak_ptr_unittest.cc index 4b73d17..be28e52 100644 --- a/base/memory/weak_ptr_unittest.cc +++ b/base/memory/weak_ptr_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -335,4 +335,12 @@ TEST(WeakPtrTest, OwnerThreadDeletesObject) { thread.DeleteConsumer(consumer_copy); } +TEST(WeakPtrTest, Dereference) { + Base data; + WeakPtrFactory<Base> factory(&data); + WeakPtr<Base> ptr = factory.GetWeakPtr(); + EXPECT_EQ(&data, ptr.get()); + EXPECT_EQ(&data, *ptr); +} + } // namespace base |