[cairo-commit] 4 commits - src/cairo-user-font.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 11 11:59:05 UTC 2022


 src/cairo-user-font.c |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit cd21fa08144fe22d0b4c28a77f654b4e6fda11ef
Merge: 396d258e4 1bc922d04
Author: Emmanuele Bassi <ebassi at gmail.com>
Date:   Fri Feb 11 11:59:03 2022 +0000

    Merge branch 'fix-user-font-leaks' into 'master'
    
    user-font: Plug some memory leaks
    
    See merge request cairo/cairo!271

commit 1bc922d0454080475844dcb2bf32eaa0c9b79889
Author: Emmanuele Bassi <ebassi at gmail.com>
Date:   Fri Feb 11 10:58:39 2022 +0000

    Apply 1 suggestion(s) to 1 file(s)

diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c
index 84469a937..76f64ebfb 100644
--- a/src/cairo-user-font.c
+++ b/src/cairo-user-font.c
@@ -324,7 +324,7 @@ _cairo_user_scaled_glyph_init (void			 *abstract_font,
         }
 
         if (surface)
-            cairo_surface_destroy(surface);
+            cairo_surface_destroy (surface);
     }
 
     if (info & CAIRO_SCALED_GLYPH_INFO_PATH) {
commit 139f3f25b132c173f64a6946d518dcc8a35f168e
Author: Matthias Clasen <mclasen at redhat.com>
Date:   Thu Feb 10 22:19:10 2022 -0500

    Plug another memory leak

diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c
index 2d3c691f0..84469a937 100644
--- a/src/cairo-user-font.c
+++ b/src/cairo-user-font.c
@@ -312,6 +312,7 @@ _cairo_user_scaled_glyph_init (void			 *abstract_font,
             _cairo_scaled_glyph_set_surface (scaled_glyph,
                                              &scaled_font->base,
                                              (cairo_image_surface_t *) surface);
+            surface = NULL;
         }
 
         if (scaled_glyph->recording_is_color && (info & CAIRO_SCALED_GLYPH_INFO_COLOR_SURFACE)) {
@@ -319,7 +320,11 @@ _cairo_user_scaled_glyph_init (void			 *abstract_font,
                                                    &scaled_font->base,
                                                    (cairo_image_surface_t *)surface,
 						   FALSE);
+            surface = NULL;
         }
+
+        if (surface)
+            cairo_surface_destroy(surface);
     }
 
     if (info & CAIRO_SCALED_GLYPH_INFO_PATH) {
commit 537445c4f07d02e84e6838f6f4c218487c7e113d
Author: Matthias Clasen <mclasen at redhat.com>
Date:   Thu Feb 10 21:17:58 2022 -0500

    user-font: Plug some memory leaks
    
    We were leaking a cairo_t and a surface here, in
    some code paths.

diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c
index d6427f060..2d3c691f0 100644
--- a/src/cairo-user-font.c
+++ b/src/cairo-user-font.c
@@ -187,10 +187,13 @@ _cairo_user_scaled_glyph_init (void			 *abstract_font,
 		    status = cairo_status (cr);
 		    scaled_glyph->recording_is_color = TRUE;
 		}
+		cairo_destroy (cr);
 	    }
 
 	    if (status == (cairo_int_status_t)CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED &&
 		face->scaled_font_methods.render_glyph) {
+                if (recording_surface)
+                    cairo_surface_destroy (recording_surface);
 		recording_surface = _cairo_user_scaled_font_create_recording_surface (scaled_font, FALSE);
 
 		cr = _cairo_user_scaled_font_create_recording_context (scaled_font, recording_surface, FALSE);


More information about the cairo-commit mailing list