From ab6ce336756b3e4192511538f1a0b35a1068e5e0 Mon Sep 17 00:00:00 2001 From: "Olli.Pettay%helsinki.fi" Date: Thu, 4 May 2006 15:15:31 +0000 Subject: [PATCH] Bug 336587, Crash when window gets destroyed during DOMMouseScroll event, r+sr=bz --- content/events/src/nsEventStateManager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index f30d09cb6163..be6ab27bc1da 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -1686,8 +1686,9 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext, return NS_OK; // Re-resolve |aTargetFrame| in case it was destroyed by the // DOM event handler above, bug 257998. - aTargetFrame = - aPresContext->GetPresShell()->GetPrimaryFrameFor(targetContent); + // But only if PresShell is still alive, bug 336587. + nsIPresShell* shell = aPresContext->GetPresShell(); + aTargetFrame = shell ? shell->GetPrimaryFrameFor(targetContent) : nsnull; if (!aTargetFrame) { // Without a frame we can't do the normal ancestor search for a view // to scroll. Don't fall through to the "passToParent" code at the end