From 8cd5fb6cd8c173f37946a5efdc8544852f52203f Mon Sep 17 00:00:00 2001 From: "bzbarsky@mit.edu" Date: Sun, 2 Dec 2007 18:07:16 -0800 Subject: [PATCH] Fix bug 400556 by tearing down editor a little earlier. r+sr=peterv --- docshell/base/nsDocShell.cpp | 6 ++++++ docshell/base/nsDocShellEditorData.cpp | 6 ++++++ docshell/base/nsDocShellEditorData.h | 5 ++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 4ec787854d63..834bae771714 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -1004,6 +1004,12 @@ nsDocShell::FirePageHideNotification(PRBool aIsUnload) } } + // Now make sure our editor, if any, is torn down before we go + // any farther. + if (mEditorData) { + mEditorData->TearDownEditor(); + } + return NS_OK; } diff --git a/docshell/base/nsDocShellEditorData.cpp b/docshell/base/nsDocShellEditorData.cpp index a26d6752cad8..9b69dce98877 100644 --- a/docshell/base/nsDocShellEditorData.cpp +++ b/docshell/base/nsDocShellEditorData.cpp @@ -67,6 +67,12 @@ nsDocShellEditorData::nsDocShellEditorData(nsIDocShell* inOwningDocShell) ----------------------------------------------------------------------------*/ nsDocShellEditorData::~nsDocShellEditorData() +{ + TearDownEditor(); +} + +void +nsDocShellEditorData::TearDownEditor() { if (mEditingSession) { diff --git a/docshell/base/nsDocShellEditorData.h b/docshell/base/nsDocShellEditorData.h index b624b1a4a22f..80077963b4fc 100644 --- a/docshell/base/nsDocShellEditorData.h +++ b/docshell/base/nsDocShellEditorData.h @@ -66,7 +66,7 @@ public: ~nsDocShellEditorData(); - // set a flag to say this frame should be editable when the next url loads + // set a flag to say this frame should be editable when the next url loads nsresult MakeEditable(PRBool inWaitForUriLoad); PRBool GetEditable(); @@ -84,6 +84,9 @@ public: // set the editor on this docShell nsresult SetEditor(nsIEditor *inEditor); + // Tear down the editor on this docshell, if any. + void TearDownEditor(); + protected: nsresult EnsureEditingSession();