Fixed miscellaneous leaks exposed to tinderbox leak stats by brade%netscape.com's JS checkin (rev 1.150 of navigator.js, 2000-04-28).

This commit is contained in:
dbaron%fas.harvard.edu 2000-05-01 00:26:37 +00:00
parent a805db42ec
commit 6175b3560e
10 changed files with 45 additions and 32 deletions

View File

@ -619,6 +619,8 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent,
buffer.Cut(0,startOffset);
}
aConverter.AddContent(buffer);
NS_RELEASE(range);
}
}
}

View File

@ -1760,6 +1760,8 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
if (NS_FAILED(result))
return result;
nsCOMPtr<nsIContent> theNode = aNode;
if (canContainChildren)
{
PRInt32 childIndex = 0;
@ -1774,7 +1776,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
}
else // HINTRIGHT
{
result = aNode->ChildCount(numChildren);
result = theNode->ChildCount(numChildren);
if (NS_FAILED(result))
return result;
@ -1790,12 +1792,12 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
childIndex = aOffset;
}
result = aNode->ChildAt(childIndex, aNode);
result = theNode->ChildAt(childIndex, *getter_AddRefs(theNode));
if (NS_FAILED(result))
return result;
if (!aNode)
if (!theNode)
return NS_ERROR_FAILURE;
#ifdef DONT_DO_THIS_YET
@ -1805,7 +1807,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
// Now that we have the child node, check if it too
// can contain children. If so, call this method again!
result = aNode->CanContainChildren(canContainChildren);
result = theNode->CanContainChildren(canContainChildren);
if (NS_FAILED(result))
return result;
@ -1816,7 +1818,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
if (aOffset > childIndex)
{
result = aNode->ChildCount(numChildren);
result = theNode->ChildCount(numChildren);
if (NS_FAILED(result))
return result;
@ -1824,15 +1826,15 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
newOffset = numChildren;
}
return GetFrameForNodeOffset(aNode, newOffset, aReturnFrame,aReturnOffset);
return GetFrameForNodeOffset(theNode, newOffset, aReturnFrame,aReturnOffset);
}
else
#endif // DONT_DO_THIS_YET
{
// Check to see if aNode is a text node. If it is, translate
// Check to see if theNode is a text node. If it is, translate
// aOffset into an offset into the text node.
nsCOMPtr<nsIDOMText> textNode = do_QueryInterface(aNode);
nsCOMPtr<nsIDOMText> textNode = do_QueryInterface(theNode);
if (textNode)
{
@ -1853,7 +1855,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
}
}
result = mTracker->GetPrimaryFrameFor(aNode, aReturnFrame);
result = mTracker->GetPrimaryFrameFor(theNode, aReturnFrame);
if (NS_FAILED(result))
return result;
@ -4585,7 +4587,7 @@ nsDOMSelection::ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aYes)
return rv;
for (PRUint32 i=0; i < cnt; ++i)
{
nsISupports* element = mRangeArray->ElementAt(i);
nsCOMPtr<nsISupports> element = dont_AddRef(mRangeArray->ElementAt(i));
nsCOMPtr<nsIDOMRange> range = do_QueryInterface(element);
if (!range)
return NS_ERROR_UNEXPECTED;

View File

@ -3083,7 +3083,7 @@ PRBool nsHTMLDocument::NodeIsBlock(nsIDOMNode * aNode, PRBool aPreIsBlock) const
return PR_FALSE;
// Wish mParserService could be mutable:
NS_CONST_CAST(nsHTMLDocument* , this)->mParserService = parserService;
NS_CONST_CAST(nsHTMLDocument* , this)->mParserService = dont_AddRef(parserService);
}
PRInt32 id;

View File

@ -254,6 +254,7 @@ void nsMarkupDocument::FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode
NS_RELEASE(tag);
}
}
NS_RELEASE(content);
}
nsDocument::FinishConvertToXIF(aConverter,aNode);
}

View File

@ -619,6 +619,8 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent,
buffer.Cut(0,startOffset);
}
aConverter.AddContent(buffer);
NS_RELEASE(range);
}
}
}

View File

@ -1760,6 +1760,8 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
if (NS_FAILED(result))
return result;
nsCOMPtr<nsIContent> theNode = aNode;
if (canContainChildren)
{
PRInt32 childIndex = 0;
@ -1774,7 +1776,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
}
else // HINTRIGHT
{
result = aNode->ChildCount(numChildren);
result = theNode->ChildCount(numChildren);
if (NS_FAILED(result))
return result;
@ -1790,12 +1792,12 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
childIndex = aOffset;
}
result = aNode->ChildAt(childIndex, aNode);
result = theNode->ChildAt(childIndex, *getter_AddRefs(theNode));
if (NS_FAILED(result))
return result;
if (!aNode)
if (!theNode)
return NS_ERROR_FAILURE;
#ifdef DONT_DO_THIS_YET
@ -1805,7 +1807,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
// Now that we have the child node, check if it too
// can contain children. If so, call this method again!
result = aNode->CanContainChildren(canContainChildren);
result = theNode->CanContainChildren(canContainChildren);
if (NS_FAILED(result))
return result;
@ -1816,7 +1818,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
if (aOffset > childIndex)
{
result = aNode->ChildCount(numChildren);
result = theNode->ChildCount(numChildren);
if (NS_FAILED(result))
return result;
@ -1824,15 +1826,15 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
newOffset = numChildren;
}
return GetFrameForNodeOffset(aNode, newOffset, aReturnFrame,aReturnOffset);
return GetFrameForNodeOffset(theNode, newOffset, aReturnFrame,aReturnOffset);
}
else
#endif // DONT_DO_THIS_YET
{
// Check to see if aNode is a text node. If it is, translate
// Check to see if theNode is a text node. If it is, translate
// aOffset into an offset into the text node.
nsCOMPtr<nsIDOMText> textNode = do_QueryInterface(aNode);
nsCOMPtr<nsIDOMText> textNode = do_QueryInterface(theNode);
if (textNode)
{
@ -1853,7 +1855,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
}
}
result = mTracker->GetPrimaryFrameFor(aNode, aReturnFrame);
result = mTracker->GetPrimaryFrameFor(theNode, aReturnFrame);
if (NS_FAILED(result))
return result;
@ -4585,7 +4587,7 @@ nsDOMSelection::ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aYes)
return rv;
for (PRUint32 i=0; i < cnt; ++i)
{
nsISupports* element = mRangeArray->ElementAt(i);
nsCOMPtr<nsISupports> element = dont_AddRef(mRangeArray->ElementAt(i));
nsCOMPtr<nsIDOMRange> range = do_QueryInterface(element);
if (!range)
return NS_ERROR_UNEXPECTED;

View File

@ -1760,6 +1760,8 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
if (NS_FAILED(result))
return result;
nsCOMPtr<nsIContent> theNode = aNode;
if (canContainChildren)
{
PRInt32 childIndex = 0;
@ -1774,7 +1776,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
}
else // HINTRIGHT
{
result = aNode->ChildCount(numChildren);
result = theNode->ChildCount(numChildren);
if (NS_FAILED(result))
return result;
@ -1790,12 +1792,12 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
childIndex = aOffset;
}
result = aNode->ChildAt(childIndex, aNode);
result = theNode->ChildAt(childIndex, *getter_AddRefs(theNode));
if (NS_FAILED(result))
return result;
if (!aNode)
if (!theNode)
return NS_ERROR_FAILURE;
#ifdef DONT_DO_THIS_YET
@ -1805,7 +1807,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
// Now that we have the child node, check if it too
// can contain children. If so, call this method again!
result = aNode->CanContainChildren(canContainChildren);
result = theNode->CanContainChildren(canContainChildren);
if (NS_FAILED(result))
return result;
@ -1816,7 +1818,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
if (aOffset > childIndex)
{
result = aNode->ChildCount(numChildren);
result = theNode->ChildCount(numChildren);
if (NS_FAILED(result))
return result;
@ -1824,15 +1826,15 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
newOffset = numChildren;
}
return GetFrameForNodeOffset(aNode, newOffset, aReturnFrame,aReturnOffset);
return GetFrameForNodeOffset(theNode, newOffset, aReturnFrame,aReturnOffset);
}
else
#endif // DONT_DO_THIS_YET
{
// Check to see if aNode is a text node. If it is, translate
// Check to see if theNode is a text node. If it is, translate
// aOffset into an offset into the text node.
nsCOMPtr<nsIDOMText> textNode = do_QueryInterface(aNode);
nsCOMPtr<nsIDOMText> textNode = do_QueryInterface(theNode);
if (textNode)
{
@ -1853,7 +1855,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
}
}
result = mTracker->GetPrimaryFrameFor(aNode, aReturnFrame);
result = mTracker->GetPrimaryFrameFor(theNode, aReturnFrame);
if (NS_FAILED(result))
return result;
@ -4585,7 +4587,7 @@ nsDOMSelection::ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aYes)
return rv;
for (PRUint32 i=0; i < cnt; ++i)
{
nsISupports* element = mRangeArray->ElementAt(i);
nsCOMPtr<nsISupports> element = dont_AddRef(mRangeArray->ElementAt(i));
nsCOMPtr<nsIDOMRange> range = do_QueryInterface(element);
if (!range)
return NS_ERROR_UNEXPECTED;

View File

@ -3083,7 +3083,7 @@ PRBool nsHTMLDocument::NodeIsBlock(nsIDOMNode * aNode, PRBool aPreIsBlock) const
return PR_FALSE;
// Wish mParserService could be mutable:
NS_CONST_CAST(nsHTMLDocument* , this)->mParserService = parserService;
NS_CONST_CAST(nsHTMLDocument* , this)->mParserService = dont_AddRef(parserService);
}
PRInt32 id;

View File

@ -254,6 +254,7 @@ void nsMarkupDocument::FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode
NS_RELEASE(tag);
}
}
NS_RELEASE(content);
}
nsDocument::FinishConvertToXIF(aConverter,aNode);
}

View File

@ -3044,6 +3044,7 @@ nsGfxTextControlFrame::InstallEditor()
// XXX DocShell redesign work
SetFocus();
}
NS_RELEASE(focusContent);
}
NS_RELEASE(manager);
}