From d3dcae34e4fb5e7149cef63b96f2c7049207c68a Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Thu, 5 Jan 2006 21:01:24 +0000 Subject: [PATCH] Drop evicted content viewers from their SHEntry before calling Destroy, so that state-saving can locate the PresShell. Bug 321778, r=bzbarsky. git-svn-id: svn://10.0.0.236/trunk@187014 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/shistory/src/nsSHistory.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mozilla/docshell/shistory/src/nsSHistory.cpp b/mozilla/docshell/shistory/src/nsSHistory.cpp index 9b536b9f2d3..e8f9346897e 100644 --- a/mozilla/docshell/shistory/src/nsSHistory.cpp +++ b/mozilla/docshell/shistory/src/nsSHistory.cpp @@ -798,9 +798,11 @@ nsSHistory::EvictWindowContentViewers(PRInt32 aFromIndex, PRInt32 aToIndex) printf("per SHistory limit: evicting content viewer: %s\n", spec.get()); #endif - viewer->Destroy(); + // Drop the presentation state before destroying the viewer, so that + // document teardown is able to correctly persist the state. ownerEntry->SetContentViewer(nsnull); ownerEntry->SyncPresentationState(); + viewer->Destroy(); } nsISHTransaction *temp = trans; @@ -906,9 +908,11 @@ nsSHistory::EvictGlobalContentViewer() } #endif - evictViewer->Destroy(); + // Drop the presentation state before destroying the viewer, so that + // document teardown is able to correctly persist the state. evictFromSHE->SetContentViewer(nsnull); evictFromSHE->SyncPresentationState(); + evictViewer->Destroy(); // If we only needed to evict one content viewer, then we are done. // Otherwise, continue evicting until we reach the max total limit.