From 444328db379a6461feca62ce75a56a36a9f6474e Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Fri, 13 Aug 1999 23:49:53 +0000 Subject: [PATCH] Fix for bugs 11858 and 10774. --- layout/xul/base/src/nsMenuFrame.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index 8dbf4c63ac5..a86b06350a3 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -920,6 +920,9 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString) void nsMenuFrame::Execute() { + // Get our own content node and hold on to it to keep it from going away. + nsCOMPtr content = dont_QueryInterface(mContent); + // First hide all of the open menus. if (mMenuParent) mMenuParent->HideChain(); @@ -930,8 +933,13 @@ nsMenuFrame::Execute() event.message = NS_MENU_ACTION; mContent->HandleDOMEvent(*mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); + // XXX HACK. Just gracefully exit if the node has been removed, e.g., window.close() + // was executed. + nsCOMPtr doc; + content->GetDocument(*getter_AddRefs(doc)); + // Now properly close them all up. - if (mMenuParent) + if (doc && mMenuParent) mMenuParent->DismissChain(); }