From 49d858783eff9636f8edfa2341cc581d1550a4f9 Mon Sep 17 00:00:00 2001 From: "buster%netscape.com" Date: Mon, 17 Aug 1998 19:03:36 +0000 Subject: [PATCH] fixed a memory leak where a style context was not being released when the table cell set the table column's style. --- layout/html/table/src/nsTableFrame.cpp | 5 +++-- layout/tables/nsTableFrame.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 0dcfbf6caf88..150ee4d246d5 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -2523,12 +2523,13 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext * aPresContext, // get the appropriate column frame nsTableColFrame *colFrame; GetColumnFrame(i+aCellFrame->GetColIndex(), colFrame); - if (nsTableColFrame::eWIDTH_SOURCE_CELL != colFrame->GetWidthSource()) + if (nsTableColFrame::eWIDTH_SOURCE_CELL != colFrame->GetWidthSource()) { // get the column style and set the width attribute - nsIStyleContext* colSC; + nsIStyleContext *colSC; colFrame->GetStyleContext(aPresContext, colSC); nsStylePosition* colPosition = (nsStylePosition*) colSC->GetMutableStyleData(eStyleStruct_Position); + NS_RELEASE(colSC); // set the column width attribute if (eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) { diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 0dcfbf6caf88..150ee4d246d5 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -2523,12 +2523,13 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext * aPresContext, // get the appropriate column frame nsTableColFrame *colFrame; GetColumnFrame(i+aCellFrame->GetColIndex(), colFrame); - if (nsTableColFrame::eWIDTH_SOURCE_CELL != colFrame->GetWidthSource()) + if (nsTableColFrame::eWIDTH_SOURCE_CELL != colFrame->GetWidthSource()) { // get the column style and set the width attribute - nsIStyleContext* colSC; + nsIStyleContext *colSC; colFrame->GetStyleContext(aPresContext, colSC); nsStylePosition* colPosition = (nsStylePosition*) colSC->GetMutableStyleData(eStyleStruct_Position); + NS_RELEASE(colSC); // set the column width attribute if (eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) {