Index: base/observer_list.h |
diff --git a/base/observer_list.h b/base/observer_list.h |
index 0572ba6500da0f3584eb8d507e69a962ebf751f9..8e4442e026da481fec43ea7ce830cd5ff48808db 100644 |
--- a/base/observer_list.h |
+++ b/base/observer_list.h |
@@ -202,6 +202,15 @@ template <class ContainerType> |
ObserverListBase<ObserverType>::Iter<ContainerType>::~Iter() { |
if (list_ && --list_->notify_depth_ == 0) |
list_->Compact(); |
+#if DCHECK_IS_ON() |
+ if (list_) { |
+ auto* list_raw = list_.get(); |
+ list_ = nullptr; |
+ if (!list_raw->HasWeakPtrs()) { |
+ list_raw->DetachFromSequence(); |
+ } |
+ } |
+#endif |
} |
template <class ObserverType> |