Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: Source/core/dom/MutationObserver.cpp

Issue 1072773002: Merge 192655 "MutationObserver: add a check that iterating regis..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2311/
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/MutationObserver.cpp
===================================================================
--- Source/core/dom/MutationObserver.cpp (revision 193430)
+++ Source/core/dom/MutationObserver.cpp (working copy)
@@ -156,8 +156,12 @@
m_records.clear();
InspectorInstrumentation::didClearAllMutationRecords(m_callback->executionContext(), this);
MutationObserverRegistrationSet registrations(m_registrations);
- for (auto& registration : registrations)
- registration->unregister();
+ for (auto& registration : registrations) {
+ // The registration may be already unregistered while iteration.
+ // Only call unregister if it is still in the original set.
+ if (m_registrations.contains(registration))
+ registration->unregister();
+ }
ASSERT(m_registrations.isEmpty());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698