Bug 643786 - Fix a crash caused by the HTML editor being destroyed when the document modified handler is in progress [@ nsHTMLEditRules::~nsHTMLEditRules]; r=roc

This commit is contained in:
Ehsan Akhgari
2011-03-23 15:59:06 -04:00
parent d6a511a034
commit 51dbd66184
3 changed files with 23 additions and 0 deletions

View File

@@ -9205,6 +9205,10 @@ nsHTMLEditRules::DocumentModifiedWorker()
if (!mHTMLEditor) {
return;
}
// DeleteNode below may cause a flush, which could destroy the editor
nsAutoRemovableScriptBlocker scriptBlocker;
nsCOMPtr<nsIHTMLEditor> kungFuDeathGrip(mHTMLEditor);
nsCOMPtr<nsISelection> selection;
nsresult res = mHTMLEditor->GetSelection(getter_AddRefs(selection));