Closed Bug 1163482 Opened 9 years ago Closed 2 years ago

eliminate FTUserFontDataRef in gfxFcPlatformFontList.cpp

Categories

(Core :: Graphics: Text, defect)

defect
Not set
normal

Tracking

()

RESOLVED INACTIVE
Tracking Status
firefox40 --- affected

People

(Reporter: jtd, Unassigned)

References

Details

(Whiteboard: gfx-noted)

From bug 1056479, comment 78:

>+        // for data fonts, add the face/data pointer to the cairo font face
>+        // so that it gets deleted whenever cairo decides
>+        NS_ASSERTION(mFTFace, "FT_Face is null when setting user data");
>+        NS_ASSERTION(mUserFontData, "user font data is null when setting user data");
>+        cairo_font_face_set_user_data(face,
>+                                      &sFcFontlistUserFontDataKey,
>+                                      new FTUserFontDataRef(mUserFontData),
>+                                      FTUserFontDataRef::Destroy);

This works but could be much simpler.

There is only one (at the most) FTUserFontData per gfxFontconfigFontEntry, so
the gfxFontconfigFontEntry can be referenced and released instead of the
FTUserFontData.

Also the FTUserFontDataRef merely holds a pointer to the ref-counted object.
It's not necessary to allocate a new object just to hold a pointer; AddRef()
can be called before cairo_font_face_set_user_data() and the destroy callback
can Release().
Blocks: 1056479
Whiteboard: gfx-noted

The bug assignee didn't login in Bugzilla in the last 7 months.
:lsalzman, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: jd.bugzilla → nobody
Flags: needinfo?(lsalzman)
Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(lsalzman)
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.