Bug 635420 - Clicking on content within Normal tab of Composer and stops switching to other tabs; r=ehsan a=bsmedberg
authorNeil Rashbrook <neil@httl.net>
Mon, 28 Feb 2011 13:04:05 -0800
changeset 63178 7fbcd2458b9ee583fc13c07ca847e2a44ca0239c
parent 63177 621e26f425427b029755ad03cc139373d743bc4d
child 63179 f787a45488268c0392e8e71b7c32b275115c96f9
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersehsan, bsmedberg
bugs635420
milestone2.0b13pre
Bug 635420 - Clicking on content within Normal tab of Composer and stops switching to other tabs; r=ehsan a=bsmedberg
editor/composer/src/nsEditingSession.cpp
editor/libeditor/base/nsEditor.cpp
--- a/editor/composer/src/nsEditingSession.cpp
+++ b/editor/composer/src/nsEditingSession.cpp
@@ -448,17 +448,19 @@ nsEditingSession::SetupEditorOnWindow(ns
   }
 
   // create and set editor
   nsCOMPtr<nsIEditorDocShell> editorDocShell = do_QueryInterface(docShell, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Try to reuse an existing editor
   nsCOMPtr<nsIEditor> editor = do_QueryReferent(mExistingEditor);
-  if (!editor) {
+  if (editor) {
+    editor->PreDestroy(PR_FALSE);
+  } else {
     editor = do_CreateInstance(classString, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
     mExistingEditor = do_GetWeakReference(editor);
   }
   // set the editor on the docShell. The docShell now owns it.
   rv = editorDocShell->SetEditor(editor);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -435,16 +435,17 @@ nsEditor::PreDestroy(PRBool aDestroyingF
   NotifyDocumentListeners(eDocumentToBeDestroyed);
 
   // Unregister event listeners
   RemoveEventListeners();
   mActionListeners.Clear();
   mEditorObservers.Clear();
   mDocStateListeners.Clear();
   mInlineSpellChecker = nsnull;
+  mRootElement = nsnull;
 
   mDidPreDestroy = PR_TRUE;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsEditor::GetFlags(PRUint32 *aFlags)
 {