summaryrefslogtreecommitdiff
path: root/runtime/base/debug_stack.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/base/debug_stack.h')
-rw-r--r--runtime/base/debug_stack.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/base/debug_stack.h b/runtime/base/debug_stack.h
index e19aecb712..886065db30 100644
--- a/runtime/base/debug_stack.h
+++ b/runtime/base/debug_stack.h
@@ -94,11 +94,19 @@ class DebugStackReferenceImpl {
DebugStackReferenceImpl(const DebugStackReferenceImpl& other)
: counter_(other.counter_), ref_count_(counter_->IncrementRefCount()) {
}
+ DebugStackReferenceImpl(DebugStackReferenceImpl&& other)
+ : counter_(other.counter_), ref_count_(other.ref_count_) {
+ other.counter_ = nullptr;
+ }
DebugStackReferenceImpl& operator=(const DebugStackReferenceImpl& other) {
CHECK(counter_ == other.counter_);
return *this;
}
- ~DebugStackReferenceImpl() { counter_->DecrementRefCount(); }
+ ~DebugStackReferenceImpl() {
+ if (counter_ != nullptr) {
+ counter_->DecrementRefCount();
+ }
+ }
void CheckTop() { CHECK_EQ(counter_->GetRefCount(), ref_count_); }
private: