Closed Bug 1034914 Opened 10 years ago Closed 10 years ago

Remove dangerous public destructor of nsFilteredContentIterator

Categories

(Core :: DOM: Editor, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: bjacob, Assigned: mccr8)

References

Details

Attachments

(1 file)

In bug 1028588 we removed dangerous public destructors of XPCOM-refcounted classes outside of a finite whitelist, see HasDangerousPublicDestructor. Now we are going over the entries in this whitelist.

One of them is: nsFilteredContentIterator
Assignee: nobody → continuation
The code in nsTextServicesDocument::CreateContentIterator really doesn't trust null checks.
1991   nsFilteredContentIterator* filter = new nsFilteredContentIterator(mTxtSvcFilter);
1992   *aIterator = static_cast<nsIContentIterator *>(filter);
1993   if (*aIterator) {
1994     NS_IF_ADDREF(*aIterator);
1995     result = filter ? NS_OK : NS_ERROR_FAILURE;
1996   } else {
...
1999   }
...
2002   NS_ENSURE_TRUE(*aIterator, NS_ERROR_NULL_POINTER);

I count 4 null checks of the same value.
Attachment #8452488 - Flags: review?(ehsan) → review+
https://hg.mozilla.org/mozilla-central/rev/fdbf7d256b43
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: