[gnome-shell/gnome-3-0] st-private: Correct fix for memory leak
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-0] st-private: Correct fix for memory leak
- Date: Thu, 12 May 2011 18:43:43 +0000 (UTC)
commit ba5c45deaf2fd6297f2832a225c7fca2c4732793
Author: Colin Walters <walters verbum org>
Date: Wed May 11 11:21:18 2011 -0400
st-private: Correct fix for memory leak
The previous fix in 72f9f482d was wrong; we need to keep around
the buffer until cairo is done with the pattern.
https://bugzilla.gnome.org/show_bug.cgi?id=649497
src/st/st-private.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index 51798a1..21ca09a 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -667,6 +667,7 @@ cairo_pattern_t *
_st_create_shadow_cairo_pattern (StShadow *shadow_spec,
cairo_pattern_t *src_pattern)
{
+ static cairo_user_data_key_t shadow_pattern_user_data;
cairo_t *cr;
cairo_surface_t *src_surface;
cairo_surface_t *surface_in;
@@ -728,6 +729,8 @@ _st_create_shadow_cairo_pattern (StShadow *shadow_spec,
width_out,
height_out,
rowstride_out);
+ cairo_surface_set_user_data (surface_out, &shadow_pattern_user_data,
+ pixels_out, (cairo_destroy_func_t) g_free);
dst_pattern = cairo_pattern_create_for_surface (surface_out);
cairo_surface_destroy (surface_out);
@@ -745,8 +748,7 @@ _st_create_shadow_cairo_pattern (StShadow *shadow_spec,
(width_out - width_in) / 2.0,
(height_out - height_in) / 2.0);
cairo_pattern_set_matrix (dst_pattern, &shadow_matrix);
-
- goto out;
+ return dst_pattern;
}
/* Read all the code from the cairo_pattern_set_matrix call
@@ -784,8 +786,6 @@ _st_create_shadow_cairo_pattern (StShadow *shadow_spec,
cairo_pattern_set_matrix (dst_pattern, &shadow_matrix);
- out:
- g_free (pixels_out);
return dst_pattern;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]