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,