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

Unified Diff: third_party/WebKit/Source/core/dom/MutationObserverRegistration.cpp

Issue 2532003002: MutationObserver: Fix a null-pointer dereference in MutationObserverRegistration::unregister. (Closed)
Patch Set: Created 4 years, 1 month 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
Index: third_party/WebKit/Source/core/dom/MutationObserverRegistration.cpp
diff --git a/third_party/WebKit/Source/core/dom/MutationObserverRegistration.cpp b/third_party/WebKit/Source/core/dom/MutationObserverRegistration.cpp
index e92b88a62ea344cbb8b2dfd9e05111b86480deeb..86bd65c37289fddbfa6b4b383112f11897d029f9 100644
--- a/third_party/WebKit/Source/core/dom/MutationObserverRegistration.cpp
+++ b/third_party/WebKit/Source/core/dom/MutationObserverRegistration.cpp
@@ -107,10 +107,11 @@ void MutationObserverRegistration::clearTransientRegistrations() {
}
void MutationObserverRegistration::unregister() {
- DCHECK(m_registrationNode);
- m_registrationNode->unregisterMutationObserver(this);
- // The above line will cause this object to be deleted, so don't do any more
- // in this function.
+ // |this| can outlives m_registrationNode.
+ if (m_registrationNode)
+ m_registrationNode->unregisterMutationObserver(this);
+ else
+ dispose();
}
bool MutationObserverRegistration::shouldReceiveMutationFrom(

Powered by Google App Engine
This is Rietveld 408576698