diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 631e529134e..8219b318854 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -13663,6 +13663,7 @@ nsCSSFrameConstructor::LazyGenerateChildrenEvent::Run() // this is hard-coded to handle only menu popup frames nsIFrame* frame = mPresShell->GetPrimaryFrameFor(mContent); if (frame && frame->GetType() == nsGkAtoms::menuPopupFrame) { + nsWeakFrame weakFrame(frame); #ifdef MOZ_XUL // it is possible that the frame is different than the one that requested // the lazy generation, but as long as it's a popup frame that hasn't @@ -13700,7 +13701,7 @@ nsCSSFrameConstructor::LazyGenerateChildrenEvent::Run() fc->EndUpdate(); } - if (mCallback) + if (mCallback && weakFrame.IsAlive()) mCallback(mContent, frame, mArg); // call XBL constructors after the frames are created