Bug 143903 crash if I close the mail window while a save as dialog is open for a message attachment

patch by antonio.xu@sun.com r=dbaron sr=waterson
This commit is contained in:
timeless%mac.com 2002-06-21 01:55:14 +00:00
parent 55eb2e7bc5
commit 296945c4b1
4 changed files with 16 additions and 4 deletions

View File

@ -8049,7 +8049,8 @@ nsCSSFrameConstructor::FindPreviousSibling(nsIPresShell* aPresShell,
NS_ASSERTION(aPresShell && aContainer, "null arguments");
ChildIterator first, iter;
ChildIterator::Init(aContainer, &first, &iter);
nsresult rv = ChildIterator::Init(aContainer, &first, &iter);
NS_ENSURE_SUCCESS(rv, nsnull);
iter.seek(aIndexInContainer);
PRUint8 childDisplay = UNSET_DISPLAY;
@ -8115,7 +8116,8 @@ nsCSSFrameConstructor::FindNextSibling(nsIPresShell* aPresShell,
const nsIContent* aChild)
{
ChildIterator iter, last;
ChildIterator::Init(aContainer, &iter, &last);
nsresult rv = ChildIterator::Init(aContainer, &iter, &last);
NS_ENSURE_SUCCESS(rv, nsnull);
iter.seek(aIndexInContainer);
// Catch the case where someone tries to append

View File

@ -45,6 +45,10 @@ ChildIterator::Init(nsIContent* aContent,
ChildIterator* aFirst,
ChildIterator* aLast)
{
// Initialize out parameters to be equal, in case of failure.
aFirst->mContent = aLast->mContent = nsnull;
aFirst->mIndex = aLast->mIndex = 0;
NS_PRECONDITION(aContent != nsnull, "no content");
if (! aContent)
return NS_ERROR_NULL_POINTER;

View File

@ -8049,7 +8049,8 @@ nsCSSFrameConstructor::FindPreviousSibling(nsIPresShell* aPresShell,
NS_ASSERTION(aPresShell && aContainer, "null arguments");
ChildIterator first, iter;
ChildIterator::Init(aContainer, &first, &iter);
nsresult rv = ChildIterator::Init(aContainer, &first, &iter);
NS_ENSURE_SUCCESS(rv, nsnull);
iter.seek(aIndexInContainer);
PRUint8 childDisplay = UNSET_DISPLAY;
@ -8115,7 +8116,8 @@ nsCSSFrameConstructor::FindNextSibling(nsIPresShell* aPresShell,
const nsIContent* aChild)
{
ChildIterator iter, last;
ChildIterator::Init(aContainer, &iter, &last);
nsresult rv = ChildIterator::Init(aContainer, &iter, &last);
NS_ENSURE_SUCCESS(rv, nsnull);
iter.seek(aIndexInContainer);
// Catch the case where someone tries to append

View File

@ -45,6 +45,10 @@ ChildIterator::Init(nsIContent* aContent,
ChildIterator* aFirst,
ChildIterator* aLast)
{
// Initialize out parameters to be equal, in case of failure.
aFirst->mContent = aLast->mContent = nsnull;
aFirst->mIndex = aLast->mIndex = 0;
NS_PRECONDITION(aContent != nsnull, "no content");
if (! aContent)
return NS_ERROR_NULL_POINTER;