Bug 1461118 - Null-check mGeckoChild after calling DispatchInputEvent. r=spohl, a=RyanVM
authorMarkus Stange <mstange@themasta.com>
Mon, 28 May 2018 18:00:35 -0400
changeset 471081 1a44b26d00a582d19259018d4d467d5bf62dbbbd
parent 471080 92bbbb44e97deeca509a1eb51d2d0f76a1091b3a
child 471082 409cd4e30401f3ffcb3b23c1fb6114fce3fe0975
push id9290
push userryanvm@gmail.com
push dateWed, 30 May 2018 18:31:27 +0000
treeherdermozilla-beta@409cd4e30401 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl, RyanVM
bugs1461118
milestone61.0
Bug 1461118 - Null-check mGeckoChild after calling DispatchInputEvent. r=spohl, a=RyanVM MozReview-Commit-ID: 4bfe8TM4GuS
widget/cocoa/nsChildView.mm
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -4576,16 +4576,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
   // Remember the event's position before calling DispatchInputEvent, because
   // that call can mutate it and convert it into a different coordinate space.
   LayoutDeviceIntPoint pos = geckoEvent.mRefPoint;
 
   // This might destroy our widget (and null out mGeckoChild).
   bool defaultPrevented =
     (mGeckoChild->DispatchInputEvent(&geckoEvent) == nsEventStatus_eConsumeNoDefault);
 
+  if (!mGeckoChild) {
+    return;
+  }
+
   // Check to see if we are double-clicking in draggable parts of the window.
   if (!defaultPrevented && [theEvent clickCount] == 2 &&
       !mGeckoChild->GetNonDraggableRegion().Contains(pos.x, pos.y)) {
     if ([self shouldZoomOnDoubleClick]) {
       [[self window] performZoom:nil];
     } else if ([self shouldMinimizeOnTitlebarDoubleClick]) {
       NSButton *minimizeButton = [[self window] standardWindowButton:NSWindowMiniaturizeButton];
       [minimizeButton performClick:self];