From e6315d638a941c14c2d8d70dea903cac4896a98e Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Sun, 26 May 2002 17:03:42 +0000 Subject: [PATCH] Clear the undisplayed content map before calling SetDocument(null), which can cause some XBL content to be destroyed without notifications, leaving dangling pointers in the undisplayed map. b=145737 r=bzbarsky sr=waterson --- content/base/src/nsDocumentViewer.cpp | 11 +++++++++++ layout/base/nsDocumentViewer.cpp | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/content/base/src/nsDocumentViewer.cpp b/content/base/src/nsDocumentViewer.cpp index 9781ff561280..4b9aa13adb44 100644 --- a/content/base/src/nsDocumentViewer.cpp +++ b/content/base/src/nsDocumentViewer.cpp @@ -1618,6 +1618,17 @@ DocumentViewerImpl::Close() } #endif + // Before we clear the script global object, clear the undisplayed + // content map, since XBL content can be destroyed by the + // |SetDocument(null, ...)| triggered by calling + // |SetScriptGlobalObject(null)|. + if (mPresShell) { + nsCOMPtr frameManager; + mPresShell->GetFrameManager(getter_AddRefs(frameManager)); + if (frameManager) + frameManager->ClearUndisplayedContentMap(); + } + // Break global object circular reference on the document created // in the DocViewer Init nsCOMPtr globalObject; diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 9781ff561280..4b9aa13adb44 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1618,6 +1618,17 @@ DocumentViewerImpl::Close() } #endif + // Before we clear the script global object, clear the undisplayed + // content map, since XBL content can be destroyed by the + // |SetDocument(null, ...)| triggered by calling + // |SetScriptGlobalObject(null)|. + if (mPresShell) { + nsCOMPtr frameManager; + mPresShell->GetFrameManager(getter_AddRefs(frameManager)); + if (frameManager) + frameManager->ClearUndisplayedContentMap(); + } + // Break global object circular reference on the document created // in the DocViewer Init nsCOMPtr globalObject;