From 9632c87bbf6bc33a01f97547c27e4dcded08e961 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Sat, 26 Sep 1998 00:37:26 +0000 Subject: [PATCH] Fixed memory leak (bug #910) --- layout/generic/nsBlockFrame.cpp | 8 ++++++++ layout/generic/nsBlockReflowState.cpp | 8 ++++++++ layout/generic/nsBlockReflowState.h | 8 ++++++++ layout/html/base/src/nsBlockFrame.cpp | 8 ++++++++ layout/html/base/src/nsBlockReflowState.cpp | 8 ++++++++ layout/html/base/src/nsBlockReflowState.h | 8 ++++++++ 6 files changed, 48 insertions(+) diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index aa072bce727..914437a2f9e 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -1511,6 +1511,14 @@ nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) NS_IMETHODIMP nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext) { + // When we have a bullet frame and it's not in our child list then + // we need to delete it ourselves (this is the common case for + // list-item's that have outside bullets). + if ((nsnull != mBullet) && + ((nsnull == mLines) || (mBullet != mLines->mFirstChild))) { + mBullet->DeleteFrame(aPresContext); + } + DeleteLineList(aPresContext, mLines); DeleteLineList(aPresContext, mOverflowLines); diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index aa072bce727..914437a2f9e 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -1511,6 +1511,14 @@ nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) NS_IMETHODIMP nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext) { + // When we have a bullet frame and it's not in our child list then + // we need to delete it ourselves (this is the common case for + // list-item's that have outside bullets). + if ((nsnull != mBullet) && + ((nsnull == mLines) || (mBullet != mLines->mFirstChild))) { + mBullet->DeleteFrame(aPresContext); + } + DeleteLineList(aPresContext, mLines); DeleteLineList(aPresContext, mOverflowLines); diff --git a/layout/generic/nsBlockReflowState.h b/layout/generic/nsBlockReflowState.h index aa072bce727..914437a2f9e 100644 --- a/layout/generic/nsBlockReflowState.h +++ b/layout/generic/nsBlockReflowState.h @@ -1511,6 +1511,14 @@ nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) NS_IMETHODIMP nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext) { + // When we have a bullet frame and it's not in our child list then + // we need to delete it ourselves (this is the common case for + // list-item's that have outside bullets). + if ((nsnull != mBullet) && + ((nsnull == mLines) || (mBullet != mLines->mFirstChild))) { + mBullet->DeleteFrame(aPresContext); + } + DeleteLineList(aPresContext, mLines); DeleteLineList(aPresContext, mOverflowLines); diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index aa072bce727..914437a2f9e 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -1511,6 +1511,14 @@ nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) NS_IMETHODIMP nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext) { + // When we have a bullet frame and it's not in our child list then + // we need to delete it ourselves (this is the common case for + // list-item's that have outside bullets). + if ((nsnull != mBullet) && + ((nsnull == mLines) || (mBullet != mLines->mFirstChild))) { + mBullet->DeleteFrame(aPresContext); + } + DeleteLineList(aPresContext, mLines); DeleteLineList(aPresContext, mOverflowLines); diff --git a/layout/html/base/src/nsBlockReflowState.cpp b/layout/html/base/src/nsBlockReflowState.cpp index aa072bce727..914437a2f9e 100644 --- a/layout/html/base/src/nsBlockReflowState.cpp +++ b/layout/html/base/src/nsBlockReflowState.cpp @@ -1511,6 +1511,14 @@ nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) NS_IMETHODIMP nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext) { + // When we have a bullet frame and it's not in our child list then + // we need to delete it ourselves (this is the common case for + // list-item's that have outside bullets). + if ((nsnull != mBullet) && + ((nsnull == mLines) || (mBullet != mLines->mFirstChild))) { + mBullet->DeleteFrame(aPresContext); + } + DeleteLineList(aPresContext, mLines); DeleteLineList(aPresContext, mOverflowLines); diff --git a/layout/html/base/src/nsBlockReflowState.h b/layout/html/base/src/nsBlockReflowState.h index aa072bce727..914437a2f9e 100644 --- a/layout/html/base/src/nsBlockReflowState.h +++ b/layout/html/base/src/nsBlockReflowState.h @@ -1511,6 +1511,14 @@ nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) NS_IMETHODIMP nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext) { + // When we have a bullet frame and it's not in our child list then + // we need to delete it ourselves (this is the common case for + // list-item's that have outside bullets). + if ((nsnull != mBullet) && + ((nsnull == mLines) || (mBullet != mLines->mFirstChild))) { + mBullet->DeleteFrame(aPresContext); + } + DeleteLineList(aPresContext, mLines); DeleteLineList(aPresContext, mOverflowLines);