diff options
author | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 17:15:11 +0000 |
---|---|---|
committer | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 17:15:11 +0000 |
commit | ad16b40a31c3f9e71b2c855199092b26b3959bce (patch) | |
tree | ae5e082c0ef1f613a0c59f13b94bcbc2b388754b /base/win | |
parent | e50c6ad885d066b87e6091091524c9c48bd576e2 (diff) | |
download | chromium_src-ad16b40a31c3f9e71b2c855199092b26b3959bce.zip chromium_src-ad16b40a31c3f9e71b2c855199092b26b3959bce.tar.gz chromium_src-ad16b40a31c3f9e71b2c855199092b26b3959bce.tar.bz2 |
Properly notify the handle verifier when a handle is passed around. This CL fixes issues introduced by r150508.
BUG=134694
Review URL: https://chromiumcodereview.appspot.com/10855061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/win')
-rw-r--r-- | base/win/scoped_handle.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/base/win/scoped_handle.h b/base/win/scoped_handle.h index 3378d00..7111c1a 100644 --- a/base/win/scoped_handle.h +++ b/base/win/scoped_handle.h @@ -49,7 +49,8 @@ class GenericScopedHandle { } // Move constructor for C++03 move emulation of this type. - GenericScopedHandle(RValue& other) : handle_(other.Take()) { + GenericScopedHandle(RValue& other) : handle_(Traits::NullHandle()) { + Set(other.Take()); } ~GenericScopedHandle() { @@ -62,9 +63,9 @@ class GenericScopedHandle { // Move operator= for C++03 move emulation of this type. GenericScopedHandle& operator=(RValue& other) { - // Swapping the handles helps to avoid problems while assigning a handle - // to itself. It is also cheap and matches base::scoped_ptr behavior. - Swap(other); + if (this != &other) { + Set(other.Take()); + } return *this; } @@ -97,12 +98,6 @@ class GenericScopedHandle { return &handle_; } - void Swap(GenericScopedHandle& other) { - Handle tmp = handle_; - handle_ = other.handle_; - other.handle_ = tmp; - } - // Transfers ownership away from this object. Handle Take() { Handle temp = handle_; |