Closed Bug 283374 Opened 19 years ago Closed 19 years ago

nsMsgWindow and nsMsgProgress leak due to cycle

Categories

(Thunderbird :: Message Compose Window, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
Thunderbird1.1

People

(Reporter: dbaron, Assigned: mscott)

Details

(Keywords: memory-leak)

Attachments

(3 files)

nsMsgWindow and nsMsgProgress leak since each one owns the other and nothing
breaks the cycle.

Steps to reproduce (using trace-refcnt or your favorite leak instrumentation):
 * start thunderbird
 * press Ctrl-M
 * type an email address, TAB, a subject ("test"), TAB, a message ("test")
 * click the X in the corner of the window
 * choose "Save" (to Drafts)
 * quit thunderbird

This is responsible for an increase of 1 in the ++DOMWINDOW / --DOMWINDOW count
since nsMsgProgress owns a JS object (which keeps the window object for the
compose window alive), due to the code here:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/mail/components/compose/content/MsgComposeCommands.js&rev=1.61&mark=1848#1835
re-assign to mscott
Assignee: sspitzer → mscott
oops, this might be seamonkey bug, and not tbird.  (but tbird may have this
problem, too.)
Status: NEW → ASSIGNED
Component: MailNews: Composition → Message Compose Window
Product: Core → Thunderbird
Target Milestone: --- → Thunderbird1.1
Attached patch the fixSplinter Review
good find dbaron.

I could have easily broken the cycle by calling
m_msgWindow->SetStatusFeedback(nsnull) after we issue the on stop notification 


However, I don't believe the progress class should have a strong reference to
the msg window anyway, so instead I re-wrote it to use a weak reference.

Now the progress object gets destroyed after the msg window is released
(usually on shut down). 

In addition to the weak reference change, we could also clear out the status
feedback reference by hand after the progress class issues an on stop
notification. That would cause the progress object to get deleted right away
instead of waiting until the msg window goes away or someone else sets a status
feedback object on the msg window.
Attachment #178506 - Flags: superreview?(bienvenu)
Attachment #178506 - Flags: superreview?(bienvenu) → superreview+
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: