diff --git a/mozilla/layout/generic/nsLineBox.cpp b/mozilla/layout/generic/nsLineBox.cpp index b3dcc9ec703..e7bcdf766ef 100644 --- a/mozilla/layout/generic/nsLineBox.cpp +++ b/mozilla/layout/generic/nsLineBox.cpp @@ -312,11 +312,14 @@ nsLineBox::DeleteLineList(nsIPresContext* aPresContext, nsLineList& aLines) child = nextChild; } - while (! aLines.empty()) { + nsCOMPtr shell; + aPresContext->GetShell(getter_AddRefs(shell)); + + do { nsLineBox* line = aLines.front(); aLines.pop_front(); - delete line; - } + line->Destroy(shell); + } while (! aLines.empty()); } } diff --git a/mozilla/layout/html/base/src/nsLineBox.cpp b/mozilla/layout/html/base/src/nsLineBox.cpp index b3dcc9ec703..e7bcdf766ef 100644 --- a/mozilla/layout/html/base/src/nsLineBox.cpp +++ b/mozilla/layout/html/base/src/nsLineBox.cpp @@ -312,11 +312,14 @@ nsLineBox::DeleteLineList(nsIPresContext* aPresContext, nsLineList& aLines) child = nextChild; } - while (! aLines.empty()) { + nsCOMPtr shell; + aPresContext->GetShell(getter_AddRefs(shell)); + + do { nsLineBox* line = aLines.front(); aLines.pop_front(); - delete line; - } + line->Destroy(shell); + } while (! aLines.empty()); } }