Index: src/assert-scope.cc |
diff --git a/src/assert-scope.cc b/src/assert-scope.cc |
index 38527099667acc827a55f164af22ffda4d685307..aca7683c9ad4f344760099d68e0e2648c845f39a 100644 |
--- a/src/assert-scope.cc |
+++ b/src/assert-scope.cc |
@@ -83,15 +83,21 @@ PerThreadAssertScope<kType, kAllow>::PerThreadAssertScope() |
template <PerThreadAssertType kType, bool kAllow> |
PerThreadAssertScope<kType, kAllow>::~PerThreadAssertScope() { |
+ if (data_ == nullptr) return; |
+ Release(); |
+} |
+ |
+template <PerThreadAssertType kType, bool kAllow> |
+void PerThreadAssertScope<kType, kAllow>::Release() { |
DCHECK_NOT_NULL(data_); |
data_->Set(kType, old_state_); |
if (data_->DecrementLevel()) { |
PerThreadAssertData::SetCurrent(NULL); |
delete data_; |
} |
+ data_ = nullptr; |
} |
- |
// static |
template <PerThreadAssertType kType, bool kAllow> |
bool PerThreadAssertScope<kType, kAllow>::IsAllowed() { |