Bug 1235205 - Add unregistering the dictionary removal observer to ComposeUnload(). r=mkmelin a=jorgk
authorJorg K
Thu, 14 Jan 2016 12:20:00 +0100
changeset 26653 f7158a9ad3774a4c11663a87bfdd0d2b733a2464
parent 26652 364ce3053ab9f1ace8e2a09f484dbd1b92ca0e72
child 26654 c38ce757de5bfdf593961ee5b9c501d111cc0466
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, jorgk
bugs1235205
Bug 1235205 - Add unregistering the dictionary removal observer to ComposeUnload(). r=mkmelin a=jorgk
mail/components/compose/content/MsgComposeCommands.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -2516,16 +2516,25 @@ function ComposeUnload()
 
   if (gMsgCompose)
     gMsgCompose.removeMsgSendListener(gSendListener);
 
   RemoveMessageComposeOfflineQuitObserver();
   gAttachmentNotifier.shutdown();
   ToolbarIconColor.uninit();
 
+  // Stop observing dictionary removals.
+  if (Services.obs.enumerateObservers("spellcheck-dictionary-remove")
+                                     .hasMoreElements()) {
+    // Don't try to remove the observer when at shutdown the recycled window
+    // gets unloaded, its observer was already removed at recycle time.
+    Services.obs.removeObserver(dictionaryRemovalObserver,
+                                "spellcheck-dictionary-remove");
+  }
+
   if (gMsgCompose)
     gMsgCompose.UnregisterStateListener(stateListener);
   if (gAutoSaveTimeout)
     clearTimeout(gAutoSaveTimeout);
   if (msgWindow)
     msgWindow.closeWindow();
 
   ReleaseGlobalVariables();