Closed Bug 1156094 Opened 9 years ago Closed 9 years ago

Remove the fictious requirement on the callers to nsITimer::InitWith* having to AddRef the timer

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: ehsan.akhgari, Unassigned)

References

Details

Attachments

(1 file)

The timer thread will hold a strong reference to the nsTimerImpl
object, so this requirement is unneeded.
Blocks: 1156084
I didn't look at this today because I wasn't mentally prepared to think about the correctness of timer code.  Still not prepared to think about this, but I did remember this bit of code, which suggests that the timer thread's reference is not sufficient:

http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/nsTimerImpl.cpp#237

I'll try to look at this more closely tomorrow, but WDYT about that comment?
Flags: needinfo?(ehsan)
Hmm, I don't know.  All I have to say is that most of our timers created from C++ don't have this extra ref, so the comment has to be inaccurate somehow.  :-)
Flags: needinfo?(ehsan)
I'd wager that most of our C++ callers are holding an extra ref as a nsCOMPtr member variable or similar...
That's possible.  I admit I haven't audited them all...
Comment on attachment 8594513 [details] [diff] [review]
Remove the fictious requirement on the callers to nsITimer::InitWith* having to AddRef the timer

Review of attachment 8594513 [details] [diff] [review]:
-----------------------------------------------------------------

I'm going to cancel this review, because I'm having a hard time believing that removing that requirement from the docs is safe.  And I'm fairly sure that many many other uses of timers *do* hold the required ref, and things would start breaking badly if we removed those refs as well.

The nr_timer.cpp change seems reasonable from a "use smart pointer classes, don't manually call AddRef/Release" point of view, but please get a media/mtransport peer to review that.

The nsBindingManager.cpp change is just sad-making; I'm not sure if you can reasonably use smart pointers there or not.
Attachment #8594513 - Flags: review?(nfroyd)
OK.  Let's call this WONTFIX then.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: