Closed
Bug 1167403
Opened 10 years ago
Closed 10 years ago
Mark gfxFont::GlyphChangeObserver::mFont as MOZ_NON_OWNING_REF
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla41
| Tracking | Status | |
|---|---|---|
| firefox41 | --- | fixed |
People
(Reporter: nika, Assigned: nika)
Details
(Whiteboard: [gfx-noted])
Attachments
(1 file, 1 obsolete file)
|
1.04 KB,
patch
|
jtd
:
review+
|
Details | Diff | Splinter Review |
| Assignee | ||
Comment 1•10 years ago
|
||
Comment 2•10 years ago
|
||
Comment on attachment 8609020 [details] [diff] [review]
Make gfcFont::GlyphChangeObserver::mFont a smart pointer
Review of attachment 8609020 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/thebes/gfxFont.h
@@ +1769,5 @@
> explicit GlyphChangeObserver(gfxFont *aFont) : mFont(aFont)
> {
> mFont->AddGlyphChangeObserver(this);
> }
> + nsRefPtr<gfxFont> mFont;
It looks like mFont was a weak reference. Will making it a strong reference cause it to leak?
| Assignee | ||
Comment 3•10 years ago
|
||
First time I looked through I noticed that gfxFont keeps a reference to the GlyphChangeObserver through the member mGlyphChangeObservers. This member is a nsAutoPtr<nsTHashtable<nsPtrHashKey<GlyphChangeObserver> > >, and the nsPtrHashKey entry type doesn't own it's inner pointer - it only holds a weak reference to it. So I thought it made sense to make this change.
You may be right, however, that this change would cause a memory leak. I've looked a bit closer and noticed that gfxFont's destructor enumerates through the hashtable entries, deleting the mFont property with ForgetFont.
I'll update the patch to instead mark this member as MOZ_NON_OWNING_REF, and add a comment explaining this.
| Assignee | ||
Comment 4•10 years ago
|
||
Attachment #8609020 -
Attachment is obsolete: true
Attachment #8609393 -
Flags: review?(jmuizelaar)
| Assignee | ||
Updated•10 years ago
|
Summary: Make gfxFont::GlyphChangeObserver::mFont a smart pointer → Mark gfxFont::GlyphChangeObserver::mFont as MOZ_NON_OWNING_REF
Comment 5•10 years ago
|
||
Comment on attachment 8609393 [details] [diff] [review]
Mark gfxFont::GlyphChangeObserver::mFont as MOZ_NON_OWNING_REF
John is a more appropriate reviewer
Attachment #8609393 -
Flags: review?(jmuizelaar) → review?(jdaggett)
Updated•10 years ago
|
Whiteboard: [gfx-noted]
Updated•10 years ago
|
Attachment #8609393 -
Flags: review?(jdaggett) → review+
| Assignee | ||
Updated•10 years ago
|
Assignee: nobody → michael
Keywords: checkin-needed
Keywords: checkin-needed
Comment 7•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•