Skip to content

Commit

Permalink
Bug 336978, Crash when window gets destroyed on pagehide event, r+sr=…
Browse files Browse the repository at this point in the history
…bryner
  • Loading branch information
Olli.Pettay%helsinki.fi authored and Olli.Pettay%helsinki.fi committed May 24, 2006
1 parent 1072616 commit 68d82c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docshell/base/nsDocShell.cpp
Expand Up @@ -921,6 +921,9 @@ NS_IMETHODIMP
nsDocShell::FirePageHideNotification(PRBool aIsUnload)
{
if (mContentViewer && !mFiredUnloadEvent) {
// Keep an explicit reference since calling PageHide could release
// mContentViewer
nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer);
mFiredUnloadEvent = PR_TRUE;

mContentViewer->PageHide(aIsUnload);
Expand Down
3 changes: 3 additions & 0 deletions layout/base/nsDocumentViewer.cpp
Expand Up @@ -1240,6 +1240,9 @@ DocumentViewerImpl::PageHide(PRBool aIsUnload)
if (!aIsUnload)
return NS_OK;

// if Destroy() was called during OnPageHide(), mDocument is nsnull.
NS_ENSURE_STATE(mDocument);

// First, get the window from the document...
nsPIDOMWindow *window = mDocument->GetWindow();

Expand Down

0 comments on commit 68d82c8

Please sign in to comment.