Bug 209032. Shut down popups before destroying their frames. r+sr=bzbarsky

git-svn-id: svn://10.0.0.236/trunk@154760 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu 2004-04-13 02:41:07 +00:00
parent d01f43c050
commit 81df39aebd

View File

@ -175,14 +175,28 @@ nsPopupSetFrame::Destroy(nsIPresContext* aPresContext)
{
// Remove our frame list.
if (mFrameConstructor) {
nsPopupFrameList* curFrame = mPopupList;
while (curFrame) {
nsPopupFrameList* temp = curFrame;
if (curFrame->mPopupFrame)
curFrame->mPopupFrame->Destroy(aPresContext);
curFrame = curFrame->mNextPopup;
temp->mNextPopup = nsnull;
delete temp;
if (mPopupList) {
// Try to hide any active popups
if (nsMenuFrame::sDismissalListener) {
nsCOMPtr<nsIMenuParent> menuParent;
nsMenuFrame::sDismissalListener->GetCurrentMenuParent(getter_AddRefs(menuParent));
nsIFrame* frame;
CallQueryInterface(menuParent, &frame);
// Rollup popups, but only if they're ours
if (frame && mPopupList->GetEntryByFrame(frame)) {
nsMenuFrame::sDismissalListener->Rollup();
}
}
// Actually remove each popup from the list as we go. This
// keeps things consistent so reentering won't crash us
while (mPopupList) {
mPopupList->mPopupFrame->Destroy(aPresContext);
nsPopupFrameList* temp = mPopupList;
mPopupList = mPopupList->mNextPopup;
delete temp;
}
}
}