Closed
Bug 3972
Opened 26 years ago
Closed 26 years ago
nsTimerMac.cpp:TimerImpl leaks reference counts
Categories
(Core :: XPCOM, defect, P3)
Tracking
()
RESOLVED
FIXED
M4
People
(Reporter: beard, Assigned: mozeditor)
Details
This may be related to several crashes I'm seeing.
TimerImpl::Init(nsITimerCallback*, PRUint32) increments the callback
object's reference count, but never decrements it. TimerImpl::Fire()
unceremoniously nulls out the reference to its callback object. The simplest
fix is simply to NOT null out its reference, and let the destructor do its
thing. On windows the reference isn't nulled out (nsTimer.cpp:line 310), and
on UNIX it's not either.
Reporter | ||
Comment 1•26 years ago
|
||
I have a fix for this, here're the diffs:
Index: nsTimerMac.cpp
===================================================================
RCS file: /cvsroot/mozilla/base/src/mac/nsTimerMac.cpp,v
retrieving revision 1.18
diff -r1.18 nsTimerMac.cpp
222,223c222
< if (mCallbackFunc != NULL)
< {
---
> if (mCallbackFunc != NULL) {
226,233c225,226
< else if (mCallbackObject != NULL)
< {
< nsITimerCallback* object = mCallbackObject;
< mCallbackObject = nsnull;
< // because the Notify call will release it.
< // We will release again it in the destructor if
< // it is not null when we go away!
< object->Notify(this); // Fire the timer
---
> else if (mCallbackObject != NULL) {
> mCallbackObject->Notify(this); // Fire the timer
Assignee | ||
Updated•26 years ago
|
Assignee: brendan → jfrancis
Assignee | ||
Comment 2•26 years ago
|
||
I'll look into this. I'm going to hold the change for a couple of days first to
see if there are any probs.
Assignee | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
Target Milestone: M4
Assignee | ||
Comment 3•26 years ago
|
||
adding Greg to CC list just as a matter of policy.
Assignee | ||
Updated•26 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 4•26 years ago
|
||
fixed.
You need to log in
before you can comment on or make changes to this bug.
Description
•