Bug 105739

Summary: function cairo_text_extents causes resource leaks
Product: cairo Reporter: loplrf <vgdoqd>
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description loplrf 2018-03-26 03:23:24 UTC
`cairo_text_extents` refs the current font face of cairo_t, and leads to resource leaks. The callstack is as follows

```
#0  cairo_font_face_reference (font_face=0x419908) at cairo-font-face.c:134
#1  cairo_scaled_font_create (font_face=0x439410, font_matrix=0x419340, ctm=0xbfffedb0, options=0xbfffede0) at cairo-scaled-font.c:1179
#2  _cairo_gstate_ensure_scaled_font (gstate=0x4192f0) at cairo-gstate.c:1915
#3  _cairo_gstate_get_scaled_font (gstate=0x4192f0, scaled_font=0xbfffee54) at cairo-gstate.c:1787
#4  _cairo_default_context_get_scaled_font (abstract_cr=0x4192d0) at cairo-default-context.c:1300
#5  cairo_get_scaled_font (cr=0x4192d0) at cairo.c:3348
#6  cairo_text_extents (cr=0x4192d0, utf8=0x400d8e "Hello, Cairo!", extents=0xbfffeee8) at cairo.c:3398
```
Comment 1 Uli Schlachter 2018-03-29 15:43:32 UTC
Could you provide some self-contained example that reproduces the problem, please? Preferably a self-contained one that additionally calls cairo_debug_reset_static_data() before exiting.

(See https://bugs.freedesktop.org/show_bug.cgi?id=105466#c2 for the last bug report about a memory leak in basically the same area of code from just two weeks ago.)
Comment 2 GitLab Migration User 2018-08-25 13:43:49 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/164.

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.