Closed Bug 175540 Opened 22 years ago Closed 22 years ago

[FIX]Mailnews use of arrays cleanup, part 1

Categories

(MailNews Core :: Backend, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.3alpha

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

(Keywords: memory-leak)

Attachments

(2 files, 3 obsolete files)

This patch does a few things:

1)  Replaces most uses of nsISupportsArray::ElementAt with QueryElementAt, since
    the code just QIed the nsISupports to something else immediately
2)  Replaces some uses of nsISupportsArray with nsCOMArray where this made sense
3)  Fixes a few leaks

It doesn't eliminate all calls to ElementAt in mailnews, but it leaves a lot
fewer of them....
Attached patch patch (obsolete) — Splinter Review
Attached patch same patch, diff -w (obsolete) — Splinter Review
Oh, and is the "readonly attribute nsISupportsArray msgWindowsArray;" on
nsIMsgMailSession actually useful? It's certainly not used.... and if if did not
exist, mWindows could become an nsCOMArray easily as well (it still could; would
just make the attr getter slower).
Keywords: mlk
Priority: -- → P1
Summary: Mailnews use of arrays cleanup, part 1 → [FIX]Mailnews use of arrays cleanup, part 1
Target Milestone: --- → mozilla1.3alpha
Attached patch real -w patch (obsolete) — Splinter Review
some stuff snuck in the first one that should not have.
Attachment #103472 - Attachment is obsolete: true
Dan, when you get a chance, can you verify this bug?
QA Contact: gayatri → dmose
For that matter, Dan, could you review?  ;)
Attached patch update to tipSplinter Review
Attachment #103471 - Attachment is obsolete: true
Attachment #103693 - Attachment is obsolete: true
Attachment #105700 - Flags: superreview?(alecf)
Attachment #105700 - Flags: review?(dmose)
Comment on attachment 105700 [details] [diff] [review]
update to tip

as far as the NS_ASSERTION when you're about to leak, lets just add the extra
"break;" to that if() statement - its the right thing to do, even if it doesn't
necessarily leak - might as well exit the loop early, eh?


I'm trying to think of a nicer way to do an array of nsCOMArrays, but one isn't
occuring to me. 

sr=alecf with the break; added. Nice work, there is a lot of code cleanup here.
Attachment #105700 - Flags: superreview?(alecf) → superreview+
Adding the break; would change the behavior significantly -- we would be getting
the first match instead of the last match.  I'm not willing to make that change
without a much deeper knowledge of this code...

I can spin off a separate bug on that particular chunk of code if you want.
Comment on attachment 105700 [details] [diff] [review]
update to tip

file a bug about the leak, and you've got r=dmose
Attachment #105700 - Flags: review?(dmose) → review+
Bug 181212 filed.

Checked in, except for this change to mailnews/base/src/nsMsgFolderCache.cpp:

-    *result = (nsIMsgFolderCacheElement *) m_cacheElements->Get(&hashKey);
+    *result = (nsIMsgFolderCacheElement *) m_cacheElements->Get(&hashKey).get();

that part was not supposed to sneak in.  It didn't build anyway, in a clean
tree, so.. ;)
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: