From e7c6c707de5c45f334b36a3c6abc34bcdd5399b7 Mon Sep 17 00:00:00 2001 From: "mats.palmgren%bredband.net" Date: Wed, 6 Feb 2008 18:21:31 +0000 Subject: [PATCH] Plug a nsLineIterator leak. b=414740 r+sr=roc a=blocking1.9 --- layout/generic/crashtests/414740.html | 31 +++++++++++++++++++++++ layout/generic/crashtests/crashtests.list | 1 + layout/generic/nsFrameList.cpp | 8 +++--- 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 layout/generic/crashtests/414740.html diff --git a/layout/generic/crashtests/414740.html b/layout/generic/crashtests/414740.html new file mode 100644 index 00000000000..ef557cc8829 --- /dev/null +++ b/layout/generic/crashtests/414740.html @@ -0,0 +1,31 @@ + +Testcase bug 344164 - Hang when moving right in caret browsing with this testcase + + + +text + + diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index f82b138eb77..3e349a6ad55 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -91,3 +91,4 @@ load 407009-1.xhtml load 408749-1.xhtml load 408883-1.html load 410228-1.html +load 414740.html diff --git a/layout/generic/nsFrameList.cpp b/layout/generic/nsFrameList.cpp index bbbbb8e5923..477ba1bb381 100644 --- a/layout/generic/nsFrameList.cpp +++ b/layout/generic/nsFrameList.cpp @@ -426,7 +426,7 @@ nsFrameList::List(FILE* out) const nsIFrame* nsFrameList::GetPrevVisualFor(nsIFrame* aFrame) const { - nsILineIterator* iter; + nsCOMPtr iter; if (!mFirstChild) return nsnull; @@ -438,7 +438,7 @@ nsFrameList::GetPrevVisualFor(nsIFrame* aFrame) const nsBidiLevel baseLevel = nsBidiPresUtils::GetFrameBaseLevel(mFirstChild); nsBidiPresUtils* bidiUtils = mFirstChild->PresContext()->GetBidiUtils(); - nsresult result = parent->QueryInterface(NS_GET_IID(nsILineIterator), (void**)&iter); + nsresult result = parent->QueryInterface(NS_GET_IID(nsILineIterator), getter_AddRefs(iter)); if (NS_FAILED(result) || !iter) { // Parent is not a block Frame if (parent->GetType() == nsGkAtoms::lineFrame) { @@ -503,7 +503,7 @@ nsFrameList::GetPrevVisualFor(nsIFrame* aFrame) const nsIFrame* nsFrameList::GetNextVisualFor(nsIFrame* aFrame) const { - nsILineIterator* iter; + nsCOMPtr iter; if (!mFirstChild) return nsnull; @@ -515,7 +515,7 @@ nsFrameList::GetNextVisualFor(nsIFrame* aFrame) const nsBidiLevel baseLevel = nsBidiPresUtils::GetFrameBaseLevel(mFirstChild); nsBidiPresUtils* bidiUtils = mFirstChild->PresContext()->GetBidiUtils(); - nsresult result = parent->QueryInterface(NS_GET_IID(nsILineIterator), (void**)&iter); + nsresult result = parent->QueryInterface(NS_GET_IID(nsILineIterator), getter_AddRefs(iter)); if (NS_FAILED(result) || !iter) { // Parent is not a block Frame if (parent->GetType() == nsGkAtoms::lineFrame) {