Bug 1315450 EditorEventListener::MouseClick() should check if mEditorBase is available before calling its ForceCompositionEnd() r?smaug
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
--- 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);