diff options
| -rw-r--r-- | libs/binder/ndk/include_cpp/android/binder_auto_utils.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libs/binder/ndk/include_cpp/android/binder_auto_utils.h b/libs/binder/ndk/include_cpp/android/binder_auto_utils.h index 8d60226725..2d85f90968 100644 --- a/libs/binder/ndk/include_cpp/android/binder_auto_utils.h +++ b/libs/binder/ndk/include_cpp/android/binder_auto_utils.h @@ -74,6 +74,9 @@ class SpAIBinder { * ownership of that other object. */ SpAIBinder& operator=(const SpAIBinder& other) { + if (this == &other) { + return *this; + } AIBinder_incStrong(other.mBinder); set(other.mBinder); return *this; @@ -170,8 +173,10 @@ class ScopedAResource { ScopedAResource& operator=(const ScopedAResource&) = delete; // move-constructing/assignment is okay - ScopedAResource(ScopedAResource&& other) : mT(std::move(other.mT)) { other.mT = DEFAULT; } - ScopedAResource& operator=(ScopedAResource&& other) { + ScopedAResource(ScopedAResource&& other) noexcept : mT(std::move(other.mT)) { + other.mT = DEFAULT; + } + ScopedAResource& operator=(ScopedAResource&& other) noexcept { set(other.mT); other.mT = DEFAULT; return *this; |