set parent of anonymous  to nsnull before destroying the frames, and remove the frame references from the event state mananger
r=hyatt,waterson
a=chofmann
This commit is contained in:
alecf%netscape.com 1999-12-15 20:58:32 +00:00
parent 1f31c41322
commit 3b12db1071
2 changed files with 33 additions and 0 deletions

View File

@ -1018,6 +1018,13 @@ nsTreeRowGroupFrame::ReflowAfterRowLayout(nsIPresContext* aPresContext,
}
if (nukeScrollbar || (value == "0" && !mIsFull)) {
// clear the scrollbar out of the event state manager so that the
// event manager doesn't send events to the destroyed scrollbar frames
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
ClearFrameRefs(shell, mScrollbar);
// Nuke the scrollbar.
mFrameConstructor->RemoveMappingsForFrameSubtree(aPresContext, mScrollbar, nsnull);
mScrollbarList.DestroyFrames(aPresContext);
@ -1961,6 +1968,30 @@ nsTreeRowGroupFrame :: AttributeChanged ( nsIPresContext* aPresContext, nsIConte
} // AttributeChanged
void
nsTreeRowGroupFrame::ClearFrameRefs(nsIPresShell *aShell, nsIFrame *aParent)
{
nsIFrame* child;
aParent->FirstChild(nsnull,&child);
while (child) {
// since we're destroying anonymous frames, we should also
// set the parent to null. Otherwise, the event manager holds a
// reference to the anonymous node, but the parent <scrollbar> node
// goes away
// we don't do this to aParent because that's the scrollbar node itself
nsCOMPtr<nsIContent> content;
child->GetContent(getter_AddRefs(content));
content->SetParent(nsnull);
ClearFrameRefs(aShell, child);
child->GetNextSibling(&child);
}
aShell->ClearFrameRefs(aParent);
}
//
// Paint

View File

@ -150,6 +150,8 @@ protected:
void ComputeTotalRowCount(PRInt32& rowCount, nsIContent* aParent);
static void ClearFrameRefs(nsIPresShell* aPresShell, nsIFrame *aParent);
public:
// Helpers that allow access to info. The tree is the primary consumer of this
// info.