Bug 585064 - Crash (null dereference) [@ -[ChildView inactiveWindowAcceptsMouseEvent:]. r=josh,mstange a=blocking2.0
authorSteven Michaud <smichaud@pobox.com>
Mon, 09 Aug 2010 11:12:50 -0500
changeset 49214 0f703f93e16a
parent 49213 b1e658a33221
child 49215 28ce6a3df8de
push id14946
push usersmichaud@pobox.com
push dateMon, 09 Aug 2010 16:13:27 +0000
treeherdermozilla-central@0f703f93e16a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh, mstange, blocking2
bugs585064
milestone2.0b4pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 585064 - Crash (null dereference) [@ -[ChildView inactiveWindowAcceptsMouseEvent:]. r=josh,mstange a=blocking2.0
widget/src/cocoa/nsChildView.mm
--- a/widget/src/cocoa/nsChildView.mm
+++ b/widget/src/cocoa/nsChildView.mm
@@ -5682,16 +5682,20 @@ static const char* ToEscapedString(NSStr
 
   mGeckoChild->DispatchWindowEvent(geckoEvent);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (BOOL)inactiveWindowAcceptsMouseEvent:(NSEvent*)aEvent
 {
+  // If we're being destroyed assume the default -- return YES.
+  if (!mGeckoChild)
+    return YES;
+
   nsMouseEvent geckoEvent(PR_TRUE, NS_MOUSE_ACTIVATE, nsnull, nsMouseEvent::eReal);
   [self convertCocoaMouseEvent:aEvent toGeckoEvent:&geckoEvent];
   return !mGeckoChild->DispatchWindowEvent(geckoEvent);
 }
 
 - (void)updateCocoaPluginFocusStatus:(BOOL)hasFocus
 {
   if (!mGeckoChild)
@@ -6399,16 +6403,19 @@ ChildViewMouseTracker::ViewForEvent(NSEv
 
   NSPoint windowEventLocation = nsCocoaUtils::EventLocationForWindow(aEvent, window);
   NSView* view = [[[window contentView] superview] hitTest:windowEventLocation];
   NS_ASSERTION(view, "How can the mouse be over a window but not over a view in that window?");
   if (![view isKindOfClass:[ChildView class]])
     return nil;
 
   ChildView* childView = (ChildView*)view;
+  // If childView is being destroyed return nil.
+  if (![childView widget])
+    return nil;
   return WindowAcceptsEvent(window, aEvent, childView) ? childView : nil;
 }
 
 static CGWindowLevel kDockWindowLevel = 0;
 static CGWindowLevel kPopupWindowLevel = 0;
 static CGWindowLevel kFloatingWindowLevel = 0;
 
 static BOOL WindowNumberIsUnderPoint(NSInteger aWindowNumber, NSPoint aPoint) {