Skip to content

Commit

Permalink
Bug 1645339 - Use range-based for with nsTObserverArray in xpfe. r=smaug
Browse files Browse the repository at this point in the history
  • Loading branch information
sigiesec committed Jun 16, 2020
1 parent 6eb160f commit fcfc4b9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions xpfe/appshell/nsWindowMediator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ NS_IMETHODIMP nsWindowMediator::RegisterWindow(nsIAppWindow* inWindow) {
// Create window info struct and add to list of windows
nsWindowInfo* windowInfo = new nsWindowInfo(inWindow, mTimeStamp);

ListenerArray::ForwardIterator iter(mListeners);
while (iter.HasMore()) {
iter.GetNext()->OnOpenWindow(inWindow);
for (const auto& listener : mListeners.ForwardRange()) {
listener->OnOpenWindow(inWindow);
}

if (mOldestWindow)
Expand Down Expand Up @@ -105,9 +104,8 @@ nsresult nsWindowMediator::UnregisterWindow(nsWindowInfo* inInfo) {
}

nsIAppWindow* window = inInfo->mWindow.get();
ListenerArray::ForwardIterator iter(mListeners);
while (iter.HasMore()) {
iter.GetNext()->OnCloseWindow(window);
for (const auto& listener : mListeners.ForwardRange()) {
listener->OnCloseWindow(window);
}

// Remove from the lists and free up
Expand Down

0 comments on commit fcfc4b9

Please sign in to comment.