From e42bf44e7d500348feb0064abdd76b41ff776589 Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Fri, 15 Nov 2002 00:59:28 +0000 Subject: [PATCH] Fixing topcrash bug 179548 (crash when closing tab via mouse gesture) by null checking the event target frame before dispatching the event the second time, since the first dispatch can nuke the frame. r=dbaron, sr=bzbarsky. git-svn-id: svn://10.0.0.236/trunk@133871 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsPresShell.cpp | 6 ++++-- mozilla/layout/html/base/src/nsPresShell.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 171e07f7431..c77267039b7 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -6218,12 +6218,14 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView, PRUint32 aFlags, } } - //Continue with second dispatch to system event handlers + //Continue with second dispatch to system event handlers. + // Need to null check mCurrentEventContent and mCurrentEventFrame + // since the previous dispatch could have nuked them. if (mCurrentEventContent) { rv = mCurrentEventContent->HandleDOMEvent(mPresContext, aEvent, nsnull, aFlags | NS_EVENT_FLAG_SYSTEM_EVENT, aStatus); } - else { + else if (mCurrentEventFrame) { nsIContent* targetContent; if (NS_OK == mCurrentEventFrame->GetContentForEvent(mPresContext, aEvent, &targetContent) && nsnull != targetContent) { rv = targetContent->HandleDOMEvent(mPresContext, aEvent, nsnull, diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 171e07f7431..c77267039b7 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -6218,12 +6218,14 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView, PRUint32 aFlags, } } - //Continue with second dispatch to system event handlers + //Continue with second dispatch to system event handlers. + // Need to null check mCurrentEventContent and mCurrentEventFrame + // since the previous dispatch could have nuked them. if (mCurrentEventContent) { rv = mCurrentEventContent->HandleDOMEvent(mPresContext, aEvent, nsnull, aFlags | NS_EVENT_FLAG_SYSTEM_EVENT, aStatus); } - else { + else if (mCurrentEventFrame) { nsIContent* targetContent; if (NS_OK == mCurrentEventFrame->GetContentForEvent(mPresContext, aEvent, &targetContent) && nsnull != targetContent) { rv = targetContent->HandleDOMEvent(mPresContext, aEvent, nsnull,