Closed Bug 209568 Opened 21 years ago Closed 21 years ago

[FIX]Freetype code leaks all over

Categories

(Core Graveyard :: GFX: Gtk, defect, P1)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.5alpha

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

(Keywords: memory-leak)

Attachments

(1 file, 1 obsolete file)

I haven't done a particularly thorough examination; it just failed to compile
due to some leak-proofing patches in my tree... Short list:

1)  nsFreeTypeGetFaceID leaks if Init() fails on a face
2)  LoadNodeTable and GetFontNames both leak the arrayFC array (the getter
    addrefs, they do not releas).
3)  The same functions, if the array leak is fixed, leak every single entry in
    the array, since ElementAt on an nsISupportsArray returns an _addrefed_
    pointer.

I may take a shot at converting some of this code to nsCOMArray at some point,
but in the meantime, we could try fixing the leaks by the simple expedient of
actually using nsCOMPtrs for owning references and using QueryElementAt on the
nsISupportsArray....
Attached patch Some possible leak fixes (obsolete) — Splinter Review
We probably want to read this code over and fix any other leaks we find...
Attached patch Better patchSplinter Review
Actually, looks like the faces never got leaked.  The arrays themselves did,
though.  Fixing the leaks as in attachment 125759 [details] [diff] [review] brought up the issue of
refcounted objects being just deleted and being passed around with a zero
refcount (once the refcount from the leaked array was removed).

This patch just makes everything use refcounting to ensure that life is happy.
Attachment #125759 - Attachment is obsolete: true
Comment on attachment 125792 [details] [diff] [review]
Better patch

Going for the double-Brian review.  ;)
Attachment #125792 - Flags: superreview?(bryner)
Attachment #125792 - Flags: review?(bstell)
I guess I should take this....
Assignee: pete.zha → bzbarsky
Keywords: mlk
Priority: -- → P1
Summary: Freetype code leaks all over → [FIX]Freetype code leaks all over
Target Milestone: --- → mozilla1.5alpha
Comment on attachment 125792 [details] [diff] [review]
Better patch

The logic is unchanged and looks okay to me so r=bstell@ix.netcom.com
Attachment #125792 - Flags: review?(bstell) → review+
Comment on attachment 125792 [details] [diff] [review]
Better patch

sr=me
Attachment #125792 - Flags: superreview?(bryner) → superreview+
Checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: