Bug 810094 - make nsXMLContentSink::mDocElement a COMptr. r=hsivonen

This commit is contained in:
Andrew McCreight 2012-11-12 09:43:02 -08:00
parent 66d39084cd
commit 3bb67b53b3
2 changed files with 3 additions and 5 deletions

View File

@ -101,7 +101,6 @@ nsXMLContentSink::nsXMLContentSink()
nsXMLContentSink::~nsXMLContentSink()
{
NS_IF_RELEASE(mDocElement);
if (mText) {
PR_Free(mText); // Doesn't null out, unlike PR_FREEIF
}
@ -144,7 +143,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXMLContentSink)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXMLContentSink,
nsContentSink)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCurrentHead)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mDocElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDocElement)
for (uint32_t i = 0, count = tmp->mContentStack.Length(); i < count; i++) {
const StackNode& node = tmp->mContentStack.ElementAt(i);
cb.NoteXPCOMChild(node.mContent);
@ -927,7 +926,6 @@ nsXMLContentSink::SetDocElement(int32_t aNameSpaceID,
}
mDocElement = aContent;
NS_ADDREF(mDocElement);
nsresult rv = mDocument->AppendChildTo(mDocElement, NotifyForDocElement());
if (NS_FAILED(rv)) {
// If we return false here, the caller will bail out because it won't
@ -1401,7 +1399,7 @@ nsXMLContentSink::ReportError(const PRUnichar* aErrorText,
node->RemoveChild(child, getter_AddRefs(dummy));
}
}
NS_IF_RELEASE(mDocElement);
mDocElement = nullptr;
// Clear any buffered-up text we have. It's enough to set the length to 0.
// The buffer itself is allocated when we're created and deleted in our

View File

@ -163,7 +163,7 @@ protected:
nsresult HandleCharacterData(const PRUnichar *aData, uint32_t aLength,
bool aInterruptable);
nsIContent* mDocElement;
nsCOMPtr<nsIContent> mDocElement;
nsCOMPtr<nsIContent> mCurrentHead; // When set, we're in an XHTML <haed>
PRUnichar* mText;