From 65b72822ba4b7d69c2882944949752aa594395d8 Mon Sep 17 00:00:00 2001 From: "kin%netscape.com" Date: Mon, 1 May 2000 18:21:30 +0000 Subject: [PATCH] Fix for crasher bugs 37701 and 37728. r=mjudge@netscape.com --- content/base/src/nsSelection.cpp | 8 ++++++-- layout/base/src/nsSelection.cpp | 8 ++++++-- layout/generic/nsSelection.cpp | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/content/base/src/nsSelection.cpp b/content/base/src/nsSelection.cpp index be0817a2a874..adb05e19e1d3 100644 --- a/content/base/src/nsSelection.cpp +++ b/content/base/src/nsSelection.cpp @@ -1792,14 +1792,18 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame childIndex = aOffset; } - result = theNode->ChildAt(childIndex, *getter_AddRefs(theNode)); + nsCOMPtr childNode; + + result = theNode->ChildAt(childIndex, *getter_AddRefs(childNode)); if (NS_FAILED(result)) return result; - if (!theNode) + if (!childNode) return NS_ERROR_FAILURE; + theNode = childNode; + #ifdef DONT_DO_THIS_YET // XXX: We can't use this code yet because the hinting // can cause us to attatch to the wrong line frame. diff --git a/layout/base/src/nsSelection.cpp b/layout/base/src/nsSelection.cpp index be0817a2a874..adb05e19e1d3 100644 --- a/layout/base/src/nsSelection.cpp +++ b/layout/base/src/nsSelection.cpp @@ -1792,14 +1792,18 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame childIndex = aOffset; } - result = theNode->ChildAt(childIndex, *getter_AddRefs(theNode)); + nsCOMPtr childNode; + + result = theNode->ChildAt(childIndex, *getter_AddRefs(childNode)); if (NS_FAILED(result)) return result; - if (!theNode) + if (!childNode) return NS_ERROR_FAILURE; + theNode = childNode; + #ifdef DONT_DO_THIS_YET // XXX: We can't use this code yet because the hinting // can cause us to attatch to the wrong line frame. diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index be0817a2a874..adb05e19e1d3 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -1792,14 +1792,18 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame childIndex = aOffset; } - result = theNode->ChildAt(childIndex, *getter_AddRefs(theNode)); + nsCOMPtr childNode; + + result = theNode->ChildAt(childIndex, *getter_AddRefs(childNode)); if (NS_FAILED(result)) return result; - if (!theNode) + if (!childNode) return NS_ERROR_FAILURE; + theNode = childNode; + #ifdef DONT_DO_THIS_YET // XXX: We can't use this code yet because the hinting // can cause us to attatch to the wrong line frame.