Changed DeleteFrame() to prevent unwanted view event dispatch during frame

destruction


git-svn-id: svn://10.0.0.236/trunk@13766 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
troy%netscape.com 1998-10-30 23:38:03 +00:00
parent f1177f874c
commit 2ffbe5d997
2 changed files with 36 additions and 24 deletions

View File

@ -65,21 +65,27 @@ nsContainerFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
NS_IMETHODIMP
nsContainerFrame::DeleteFrame(nsIPresContext& aPresContext)
{
// Delete our child frames before doing anything else. In particular
// we do all of this before our base class releases it's hold on the
// view.
for (nsIFrame* child = mFirstChild; child; ) {
mFirstChild = nsnull; // XXX hack until HandleEvent is not called until after destruction
nsIFrame* nextChild;
child->GetNextSibling(nextChild);
child->DeleteFrame(aPresContext);
child = nextChild;
// Prevent event dispatch during destruct
nsIView* view;
GetView(view);
if (nsnull != view) {
view->SetClientData(nsnull);
}
nsFrame::DeleteFrame(aPresContext);
// Delete our child frames
while (nsnull != mFirstChild) {
nsIFrame* nextChild;
return NS_OK;
mFirstChild->GetNextSibling(nextChild);
mFirstChild->DeleteFrame(aPresContext);
// Once we've deleted the child frame make sure it's no longer in
// our child list
mFirstChild = nextChild;
}
// Base class will delete the frame
return nsFrame::DeleteFrame(aPresContext);
}
void

View File

@ -65,21 +65,27 @@ nsContainerFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
NS_IMETHODIMP
nsContainerFrame::DeleteFrame(nsIPresContext& aPresContext)
{
// Delete our child frames before doing anything else. In particular
// we do all of this before our base class releases it's hold on the
// view.
for (nsIFrame* child = mFirstChild; child; ) {
mFirstChild = nsnull; // XXX hack until HandleEvent is not called until after destruction
nsIFrame* nextChild;
child->GetNextSibling(nextChild);
child->DeleteFrame(aPresContext);
child = nextChild;
// Prevent event dispatch during destruct
nsIView* view;
GetView(view);
if (nsnull != view) {
view->SetClientData(nsnull);
}
nsFrame::DeleteFrame(aPresContext);
// Delete our child frames
while (nsnull != mFirstChild) {
nsIFrame* nextChild;
return NS_OK;
mFirstChild->GetNextSibling(nextChild);
mFirstChild->DeleteFrame(aPresContext);
// Once we've deleted the child frame make sure it's no longer in
// our child list
mFirstChild = nextChild;
}
// Base class will delete the frame
return nsFrame::DeleteFrame(aPresContext);
}
void