diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index d4dd1f8145f..0df7eb7c09a 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -3855,6 +3855,8 @@ nsHTMLEditor::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer, return; } + nsCOMPtr kungFuDeathGrip(this); + if (ShouldReplaceRootElement()) { ResetRootElementAndEventTarget(); } @@ -3874,6 +3876,8 @@ nsHTMLEditor::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer, nsIContent* aChild, PRInt32 aIndexInContainer, nsIContent* aPreviousSibling) { + nsCOMPtr kungFuDeathGrip(this); + if (SameCOMIdentity(aChild, mRootElement)) { ResetRootElementAndEventTarget(); }