From b64ecb5d25f2aadddaae04ad666c6cfe3e44f257 Mon Sep 17 00:00:00 2001 From: "timeless%mac.com" Date: Wed, 7 Aug 2002 08:23:46 +0000 Subject: [PATCH] Bug 135811 Crash after infinite recursion: nsContentTreeOwner::FindItemWithName -> nsDocShell::FindItemWithName -> nsDocShell::FindItemWithName (loop back to nsContentTreeOwner) - Trunk M1BR [@ ntdll.dll - nsDocShell::FindItemWithName] [@ MSVCRT.DLL - nsWritingIterator::write] patch by adamlock r=mjudge sr=jst git-svn-id: svn://10.0.0.236/trunk@126650 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index fc2760c19b9..9075d3ccd8f 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -400,6 +400,12 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink) if (NS_SUCCEEDED(rv) && shell) return shell->QueryInterface(aIID,aSink); } + else if (aIID.Equals(NS_GET_IID(nsIDocShellTreeOwner))) { + nsCOMPtr treeOwner; + nsresult rv = GetTreeOwner(getter_AddRefs(treeOwner)); + if (NS_SUCCEEDED(rv) && treeOwner) + return treeOwner->QueryInterface(aIID, aSink); + } else { return QueryInterface(aIID, aSink); } @@ -1747,9 +1753,9 @@ nsDocShell::FindItemWithName(const PRUnichar * aName, // If the parent isn't of the same type fall through and ask tree owner. } - // This QI may fail, but comparing against null serves the same purpose + // This may fail, but comparing against null serves the same purpose nsCOMPtr - reqAsTreeOwner(do_QueryInterface(aRequestor)); + reqAsTreeOwner(do_GetInterface(aRequestor)); if (mTreeOwner && (mTreeOwner != reqAsTreeOwner.get())) { NS_ENSURE_SUCCESS(mTreeOwner->FindItemWithName(aName,