From d72db37d8379a4d7910de97dd89d7e27bca8ba66 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Mon, 3 Aug 1998 19:21:26 +0000 Subject: [PATCH] Fixed reference counting bugs with OPTION tag handling git-svn-id: svn://10.0.0.236/trunk@7127 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/html/document/src/nsHTMLContentSink.cpp | 5 +++++ mozilla/layout/html/document/src/nsHTMLContentSink.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index d7d83c3e9f2..385f21b4429 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -2064,6 +2064,10 @@ HTMLContentSink::ProcessOpenOPTIONTag(nsIHTMLContent** aInstancePtrResult, nsIAtom* atom = NS_NewAtom(tmp); rv = NS_NewHTMLOption(&mCurrentOption, atom); if ((NS_OK == rv) && (nsnull != mCurrentSelect)) { + // Add another reference to the option since we remember it both + // on our container stack and in mCurrentOption + NS_ADDREF(mCurrentOption); + // Add remaining attributes from the tag //rv = AddAttributes(aNode, mCurrentOption); *aInstancePtrResult = mCurrentOption; @@ -2112,6 +2116,7 @@ HTMLContentSink::ProcessOPTIONTagContent(const nsIParserNode& aNode) break; } control->SetContent(currentText); + NS_RELEASE(control); } } return NS_OK; diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index d7d83c3e9f2..385f21b4429 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -2064,6 +2064,10 @@ HTMLContentSink::ProcessOpenOPTIONTag(nsIHTMLContent** aInstancePtrResult, nsIAtom* atom = NS_NewAtom(tmp); rv = NS_NewHTMLOption(&mCurrentOption, atom); if ((NS_OK == rv) && (nsnull != mCurrentSelect)) { + // Add another reference to the option since we remember it both + // on our container stack and in mCurrentOption + NS_ADDREF(mCurrentOption); + // Add remaining attributes from the tag //rv = AddAttributes(aNode, mCurrentOption); *aInstancePtrResult = mCurrentOption; @@ -2112,6 +2116,7 @@ HTMLContentSink::ProcessOPTIONTagContent(const nsIParserNode& aNode) break; } control->SetContent(currentText); + NS_RELEASE(control); } } return NS_OK;