diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp index f4f36cfb6d6..c5a14cc3fd4 100644 --- a/mozilla/content/events/src/nsEventStateManager.cpp +++ b/mozilla/content/events/src/nsEventStateManager.cpp @@ -803,7 +803,9 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext, nsCOMPtr document = GetDocumentFromWindow(focusedWindow); if (document) { - nsIPresShell *shell = document->GetShellAt(0); + // Use a strong ref to make sure that the shell is alive still + // when calling FrameSelection(). + nsCOMPtr shell = document->GetShellAt(0); NS_ASSERTION(shell, "Focus events should not be getting thru when this is null!"); if (shell) { if (focusedElement) {