Bug 1315450 EditorEventListener::MouseClick() should check if mEditorBase is available before calling its ForceCompositionEnd() r=smaug, a=jcristau
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 30 Jan 2017 17:03:02 +0900
changeset 375777 e388fdc06380d4689d5a914fa7708452cc223e8b
parent 375776 3354522f515533c93aab4d0d0178b37079b4dd5a
child 375778 5ae7001fbd3f6441525f70a8c4c2db12c5ce5b00
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, jcristau
bugs1315450
milestone53.0a2
Bug 1315450 EditorEventListener::MouseClick() should check if mEditorBase is available before calling its ForceCompositionEnd() r=smaug, a=jcristau IMEStateManager::OnClickInEditor() may cause anything because it may set input context. For example, it may cause opening VKB, changing focus or reflow. So, mEditorBase here might have been gone. MozReview-Commit-ID: C0SVzb5SueS
editor/libeditor/EditorEventListener.cpp
--- a/editor/libeditor/EditorEventListener.cpp
+++ b/editor/libeditor/EditorEventListener.cpp
@@ -662,16 +662,23 @@ EditorEventListener::MouseClick(nsIDOMMo
 
   bool preventDefault;
   nsresult rv = aMouseEvent->AsEvent()->GetDefaultPrevented(&preventDefault);
   if (NS_FAILED(rv) || preventDefault) {
     // We're done if 'preventdefault' is true (see for example bug 70698).
     return rv;
   }
 
+  // IMEStateManager::OnClickInEditor() may cause anything because it may
+  // set input context.  For example, it may cause opening VKB, changing focus
+  // or reflow.  So, mEditorBase here might have been gone.
+  if (!mEditorBase) {
+    return NS_OK;
+  }
+
   // If we got a mouse down inside the editing area, we should force the
   // IME to commit before we change the cursor position
   mEditorBase->ForceCompositionEnd();
 
   int16_t button = -1;
   aMouseEvent->GetButton(&button);
   if (button == 1) {
     return HandleMiddleClickPaste(aMouseEvent);