Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit a4d904b

Browse files
committed
Bug 1866954: avoid copying a Refptr in ForEachGlobalTeardownObserver r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D194844
1 parent 4624c50 commit a4d904b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dom/base/nsIGlobalObject.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,14 @@ void nsIGlobalObject::ForEachGlobalTeardownObserver(
181181
// while we are iterating by copying the DETH references to a temporary
182182
// list.
183183
AutoTArray<RefPtr<GlobalTeardownObserver>, 64> targetList;
184-
for (const GlobalTeardownObserver* deth = mGlobalTeardownObservers.getFirst();
185-
deth; deth = deth->getNext()) {
186-
targetList.AppendElement(const_cast<GlobalTeardownObserver*>(deth));
184+
for (const GlobalTeardownObserver* gto = mGlobalTeardownObservers.getFirst();
185+
gto; gto = gto->getNext()) {
186+
targetList.AppendElement(const_cast<GlobalTeardownObserver*>(gto));
187187
}
188188

189189
// Iterate the target list and call the function on each one.
190190
bool done = false;
191-
for (auto target : targetList) {
191+
for (auto& target : targetList) {
192192
// Check to see if a previous iteration's callback triggered the removal
193193
// of this target as a side-effect. If it did, then just ignore it.
194194
if (target->GetOwnerGlobal() != this) {

0 commit comments

Comments
 (0)