diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index b184f17bf857..a34f4c0f99d3 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -1281,7 +1281,9 @@ nsMenuFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) { nsFrameList* popupList = GetPopupList(); - if (popupList && popupList->DestroyFrameIfPresent(aOldFrame)) { + if (popupList && popupList->FirstChild() == aOldFrame) { + popupList->RemoveFirstChild(); + aOldFrame->Destroy(); DestroyPopupList(); PresContext()->PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange,