Bug 18862 - cairo calls FT_Done_Face on FT_Faces for unscaled_fonts created from_face
Summary: cairo calls FT_Done_Face on FT_Faces for unscaled_fonts created from_face
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: freetype font backend (show other bugs)
Version: 1.9.1
Hardware: Other All
: medium critical
Assignee: David Turner
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
: 44859 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-12-03 02:45 UTC by Karl Tomlinson
Modified: 2012-01-17 20:28 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Only destroy FT_Faces created by cairo (624 bytes, patch)
2008-12-03 15:56 UTC, Karl Tomlinson
Details | Splinter Review

Description Karl Tomlinson 2008-12-03 02:45:14 UTC
The FT_Faces on unscaled_fonts created from_face are not owned by cairo and
therefore must not be Done by cairo.

But the code in _cairo_ft_unscaled_font_lock_face

http://cgit.freedesktop.org/cairo/tree/src/cairo-ft-font.c?id=d1801c23fae3777c7c59e084894a3410f7a1f932#n564

and _has_unlocked_face

http://cgit.freedesktop.org/cairo/tree/src/cairo-ft-font.c?id=d1801c23fae3777c7c59e084894a3410f7a1f932#n527

makes no distinction.

(It looks like the bug may have been introduced when the from_face unscaled_fonts were included in the ft_unscaled_font_map:

http://cgit.freedesktop.org/cairo/commit/?id=60cf2ef8449e1fd09fe0f2d8c8dc5fa2bb855e5a
)

This could be fixed either by testing unscaled->from_face in
_has_unlocked_face or by initializing lock_count = 1 for unscaled_fonts
from_face and appropriately modifying the assert in
_cairo_ft_unscaled_font_unlock_face.
Comment 1 Karl Tomlinson 2008-12-03 15:56:41 UTC
Created attachment 20773 [details] [review]
Only destroy FT_Faces created by cairo

testing from_face seems clearer than using lock_count
Comment 2 Behdad Esfahbod 2008-12-17 13:41:14 UTC
Pushed to master.  Leaving open to pick it up for 1.8.

commit e4d7c87b5e449a743a68dd256faaa3242f191a44
Author: Karl Tomlinson <karlt+@karlt.net>
Date:   Wed Dec 17 16:40:12 2008 -0500

    [ft] Don't call FT_Done_Face() on faces we did not create

Comment 3 Behdad Esfahbod 2008-12-17 13:42:55 UTC
Fixed in 1.8 too.
Comment 4 crusnik 2012-01-17 20:28:39 UTC
*** Bug 44859 has been marked as a duplicate of this bug. ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.