Chromium Code Reviews| Index: ui/aura/window.cc |
| diff --git a/ui/aura/window.cc b/ui/aura/window.cc |
| index d92078768d12c4d114c7178ac53db7372da53c33..58fc5d8fc93c38a1e2317f6f5a62c2e4a319bf38 100644 |
| --- a/ui/aura/window.cc |
| +++ b/ui/aura/window.cc |
| @@ -144,11 +144,9 @@ Window::~Window() { |
| if (delegate_) |
| delegate_->OnWindowDestroyed(this); |
| - base::ObserverListBase<WindowObserver>::Iterator iter(&observers_); |
| - for (WindowObserver* observer = iter.GetNext(); observer; |
| - observer = iter.GetNext()) { |
| - RemoveObserver(observer); |
| - observer->OnWindowDestroyed(this); |
| + for (auto& observer : observers_) { |
|
sky
2016/10/13 02:20:57
It's my understanding observer is a WindowObserver
dcheng
2016/10/13 02:39:22
Dereferencing the iterator currently gives you a r
sky
2016/10/13 02:41:03
If that's the case, then wouldn't the 'observer.'
dcheng
2016/10/13 02:48:42
We have a reference to the underlying object, not
loyso (OOO)
2016/10/13 03:17:40
The range based for statement defined in C++ as:
loyso (OOO)
2016/10/13 07:03:32
Also, in current implementation you are allowed to
|
| + RemoveObserver(&observer); |
| + observer.OnWindowDestroyed(this); |
| } |
| // Delete the LayoutManager before properties. This way if the LayoutManager |