From 1e949b447e08bed0e8cf2fa1725d98fd8205c6ce Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Thu, 22 Jul 1999 10:06:38 +0000 Subject: [PATCH] Fixing my while loops. They could crash under rare circumstances. git-svn-id: svn://10.0.0.236/trunk@40653 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 15 +++++++++------ .../html/style/src/nsCSSFrameConstructor.cpp | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 59ffbf9246b..ae6fec51ec4 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -4128,14 +4128,15 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, tag.get() == nsXULAtoms::treeitem)) { // Walk up to the outermost tree row group frame and tell it that // content was added. - nsCOMPtr parent = dont_QueryInterface(aContainer); + nsCOMPtr parent; nsCOMPtr child = dont_QueryInterface(aContainer); + child->GetParent(*getter_AddRefs(parent)); while (parent) { - child->GetParent(*getter_AddRefs(parent)); parent->GetTag(*getter_AddRefs(tag)); if (tag.get() == nsXULAtoms::tree) break; child = parent; + child->GetParent(*getter_AddRefs(parent)); } if (parent) { @@ -4345,14 +4346,15 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, tag.get() == nsXULAtoms::treeitem)) { // Walk up to the outermost tree row group frame and tell it that // content was added. - nsCOMPtr parent = dont_QueryInterface(aContainer); + nsCOMPtr parent; nsCOMPtr child = dont_QueryInterface(aContainer); + child->GetParent(*getter_AddRefs(parent)); while (parent) { - child->GetParent(*getter_AddRefs(parent)); parent->GetTag(*getter_AddRefs(tag)); if (tag.get() == nsXULAtoms::tree) break; child = parent; + child->GetParent(*getter_AddRefs(parent)); } if (parent) { @@ -4665,14 +4667,15 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, // has been removed (so that we can update the scrollbar state). // Walk up to the outermost tree row group frame and tell it that // content was removed. - nsCOMPtr parent = dont_QueryInterface(aContainer); + nsCOMPtr parent; nsCOMPtr child = dont_QueryInterface(aContainer); + child->GetParent(*getter_AddRefs(parent)); while (parent) { - child->GetParent(*getter_AddRefs(parent)); parent->GetTag(*getter_AddRefs(tag)); if (tag.get() == nsXULAtoms::tree) break; child = parent; + child->GetParent(*getter_AddRefs(parent)); } if (parent) { diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 59ffbf9246b..ae6fec51ec4 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -4128,14 +4128,15 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, tag.get() == nsXULAtoms::treeitem)) { // Walk up to the outermost tree row group frame and tell it that // content was added. - nsCOMPtr parent = dont_QueryInterface(aContainer); + nsCOMPtr parent; nsCOMPtr child = dont_QueryInterface(aContainer); + child->GetParent(*getter_AddRefs(parent)); while (parent) { - child->GetParent(*getter_AddRefs(parent)); parent->GetTag(*getter_AddRefs(tag)); if (tag.get() == nsXULAtoms::tree) break; child = parent; + child->GetParent(*getter_AddRefs(parent)); } if (parent) { @@ -4345,14 +4346,15 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, tag.get() == nsXULAtoms::treeitem)) { // Walk up to the outermost tree row group frame and tell it that // content was added. - nsCOMPtr parent = dont_QueryInterface(aContainer); + nsCOMPtr parent; nsCOMPtr child = dont_QueryInterface(aContainer); + child->GetParent(*getter_AddRefs(parent)); while (parent) { - child->GetParent(*getter_AddRefs(parent)); parent->GetTag(*getter_AddRefs(tag)); if (tag.get() == nsXULAtoms::tree) break; child = parent; + child->GetParent(*getter_AddRefs(parent)); } if (parent) { @@ -4665,14 +4667,15 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, // has been removed (so that we can update the scrollbar state). // Walk up to the outermost tree row group frame and tell it that // content was removed. - nsCOMPtr parent = dont_QueryInterface(aContainer); + nsCOMPtr parent; nsCOMPtr child = dont_QueryInterface(aContainer); + child->GetParent(*getter_AddRefs(parent)); while (parent) { - child->GetParent(*getter_AddRefs(parent)); parent->GetTag(*getter_AddRefs(tag)); if (tag.get() == nsXULAtoms::tree) break; child = parent; + child->GetParent(*getter_AddRefs(parent)); } if (parent) {