Closed Bug 1279609 Opened 9 years ago Closed 9 years ago

nsRunnableMethodImpl has a public destructor

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(1 file)

Having a public destructor for a refcounted class lets you call delete on it directly, which could lead to bad things. We have a static_assert to check this, but it only works on classes that actually implement refcounting (bug 1181412 is about adding a static analysis). This probably is not causing bug 1271182, but who knows. I'll see if anything turns up when I make this dtor protected.
Assignee: nobody → continuation
Fortunately it looks like nobody was calling it.
Attachment #8762164 - Flags: review?(nfroyd)
Comment on attachment 8762164 [details] [diff] [review] nsRunnableMethodImpl should use a protected destructor. Review of attachment 8762164 [details] [diff] [review]: ----------------------------------------------------------------- Do all the subclasses have appropriate destructors, too? I assume that's why you made it protected, rather than private.
Attachment #8762164 - Flags: review?(nfroyd) → review+
Pushed by amccreight@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/dbc1a4dabe05 nsRunnableMethodImpl should use a non-public destructor. r=froydnj
(In reply to Nathan Froyd [:froydnj] from comment #2) > Do all the subclasses have appropriate destructors, too? I assume that's > why you made it protected, rather than private. I made it private, though it turns out that at least as of now the class is final so it shouldn't matter. I was just using protected because that's what we use everywhere for refcounted dtors.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: