Bug 346054, Crash when removing <tooltip> before showing it, r+sr=roc, a=mtschrep

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@206605 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Olli.Pettay%helsinki.fi
2006-08-04 18:30:14 +00:00
parent 25a04b74eb
commit 476e7339e8

View File

@@ -370,7 +370,6 @@ nsPopupSetFrame::ShowPopup(nsIContent* aElementContent, nsIContent* aPopupConten
mPresContext->PresShell()->GetPrimaryFrameFor(aPopupContent,
&entry->mPopupFrame);
nsWeakFrame weakPopupFrame(entry->mPopupFrame);
#ifdef DEBUG_PINK
printf("X Pos: %d\n", mXPos);
printf("Y Pos: %d\n", mYPos);
@@ -379,20 +378,28 @@ nsPopupSetFrame::ShowPopup(nsIContent* aElementContent, nsIContent* aPopupConten
// Generate the popup.
entry->mCreateHandlerSucceeded = PR_TRUE;
entry->mIsOpen = PR_TRUE;
// This may destroy entry->mPopupFrame
// This may destroy or change entry->mPopupFrame or remove the entry from
// mPopupList. |this| may also get deleted.
MarkAsGenerated(aPopupContent);
// determine if this menu is a context menu and flag it
nsIMenuParent* childPopup = nsnull;
if (weakPopupFrame.IsAlive())
CallQueryInterface(weakPopupFrame.GetFrame(), &childPopup);
if ( childPopup && aPopupType.EqualsLiteral("context") )
childPopup->SetIsContextMenu(PR_TRUE);
if (!weakFrame.IsAlive()) {
return NS_OK;
}
nsPopupFrameList* newEntry =
mPopupList ? mPopupList->GetEntry(aPopupContent) : nsnull;
if (!newEntry || newEntry != entry) {
NS_WARNING("The popup entry for aPopupContent has changed!");
return NS_OK;
}
// determine if this menu is a context menu and flag it
nsIMenuParent* childPopup = nsnull;
if (entry->mPopupFrame)
CallQueryInterface(entry->mPopupFrame, &childPopup);
if ( childPopup && aPopupType.EqualsLiteral("context") )
childPopup->SetIsContextMenu(PR_TRUE);
// Now open the popup.
OpenPopup(entry, PR_TRUE);