Merge lp:~asac/notify-osd/lp378193_tile_memleak into lp:notify-osd/trunk

Proposed by Alexander Sack
Status: Merged
Merged at revision: not available
Proposed branch: lp:~asac/notify-osd/lp378193_tile_memleak
Merge into: lp:notify-osd/trunk
Diff against target: None lines
To merge this branch: bzr merge lp:~asac/notify-osd/lp378193_tile_memleak
Reviewer Review Type Date Requested Status
Notify OSD Developers Pending
Review via email: mp+9326@code.launchpad.net

Commit message

* fix LP: #378193 - huge memory leak in notify-osd; turned out the biggest share of
  memory leak was due to tile objects not properly destroyed in bubble.c; refactoring code a bit
  to prevent this in future
  - update src/bubble.c

To post a comment you must log in.
Revision history for this message
Alexander Sack (asac) wrote :

* fix LP: #378193 - huge memory leak in notify-osd; turned out the biggest share of
  memory leak was due to tile objects not properly destroyed in bubble.c; refactoring code a bit
  to prevent this in future
  - update src/bubble.c

(will upload to karmic asap)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/bubble.c'
--- src/bubble.c 2009-07-27 11:09:11 +0000
+++ src/bubble.c 2009-07-27 15:45:27 +0000
@@ -638,8 +638,6 @@
638 gint width;638 gint width;
639 gint height;639 gint height;
640640
641 tile_destroy (priv->tile_background);
642
643 bubble_get_size (self, &width, &height);641 bubble_get_size (self, &width, &height);
644642
645 // create temp. scratch surface for top-left shadow/background part643 // create temp. scratch surface for top-left shadow/background part
@@ -753,6 +751,8 @@
753 cairo_surface_destroy (clone);751 cairo_surface_destroy (clone);
754752
755 // finally create tile with top-left shadow/background part753 // finally create tile with top-left shadow/background part
754 if (priv->tile_background_part)
755 tile_destroy (priv->tile_background_part);
756 priv->tile_background_part = tile_new_for_padding (normal, blurred);756 priv->tile_background_part = tile_new_for_padding (normal, blurred);
757 cairo_surface_destroy (normal);757 cairo_surface_destroy (normal);
758 cairo_surface_destroy (blurred);758 cairo_surface_destroy (blurred);
@@ -850,6 +850,8 @@
850 cairo_destroy (cr);850 cairo_destroy (cr);
851851
852 // finally create tile for full background852 // finally create tile for full background
853 if (priv->tile_background)
854 tile_destroy (priv->tile_background);
853 if (priv->composited)855 if (priv->composited)
854 priv->tile_background = tile_new_for_padding (normal, blurred);856 priv->tile_background = tile_new_for_padding (normal, blurred);
855 else857 else
@@ -870,8 +872,6 @@
870 cairo_surface_t* normal = NULL;872 cairo_surface_t* normal = NULL;
871 cairo_t* cr = NULL;873 cairo_t* cr = NULL;
872874
873 tile_destroy (priv->tile_icon);
874
875 if (!priv->icon_pixbuf)875 if (!priv->icon_pixbuf)
876 return;876 return;
877877
@@ -907,6 +907,8 @@
907 cairo_paint (cr);907 cairo_paint (cr);
908908
909 // create the surface/blur-cache from the normal surface909 // create the surface/blur-cache from the normal surface
910 if (priv->tile_icon)
911 tile_destroy (priv->tile_icon);
910 priv->tile_icon = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);912 priv->tile_icon = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);
911913
912 // clean up914 // clean up
@@ -925,8 +927,6 @@
925 PangoLayout* layout = NULL;927 PangoLayout* layout = NULL;
926 raico_blur_t* blur = NULL;928 raico_blur_t* blur = NULL;
927929
928 tile_destroy (priv->tile_title);
929
930 // create temp. scratch surface930 // create temp. scratch surface
931 normal = cairo_image_surface_create (931 normal = cairo_image_surface_create (
932 CAIRO_FORMAT_ARGB32,932 CAIRO_FORMAT_ARGB32,
@@ -1011,6 +1011,8 @@
1011 g_object_unref (layout);1011 g_object_unref (layout);
10121012
1013 // create the surface/blur-cache from the normal surface1013 // create the surface/blur-cache from the normal surface
1014 if (priv->tile_title)
1015 tile_destroy (priv->tile_title);
1014 priv->tile_title = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);1016 priv->tile_title = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);
10151017
1016 // clean up1018 // clean up
@@ -1029,8 +1031,6 @@
1029 PangoLayout* layout = NULL;1031 PangoLayout* layout = NULL;
1030 raico_blur_t* blur = NULL;1032 raico_blur_t* blur = NULL;
10311033
1032 tile_destroy (priv->tile_body);
1033
1034 // create temp. scratch surface1034 // create temp. scratch surface
1035 normal = cairo_image_surface_create (1035 normal = cairo_image_surface_create (
1036 CAIRO_FORMAT_ARGB32,1036 CAIRO_FORMAT_ARGB32,
@@ -1118,6 +1118,8 @@
1118 g_object_unref (layout);1118 g_object_unref (layout);
11191119
1120 // create the surface/blur-cache from the normal surface1120 // create the surface/blur-cache from the normal surface
1121 if (priv->tile_body)
1122 tile_destroy (priv->tile_body);
1121 priv->tile_body = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);1123 priv->tile_body = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);
11221124
1123 // clean up1125 // clean up
@@ -1133,8 +1135,6 @@
1133 cairo_surface_t* normal = NULL;1135 cairo_surface_t* normal = NULL;
1134 cairo_t* cr = NULL;1136 cairo_t* cr = NULL;
11351137
1136 tile_destroy (priv->tile_indicator);
1137
1138 // create temp. scratch surface1138 // create temp. scratch surface
1139 normal = cairo_image_surface_create (1139 normal = cairo_image_surface_create (
1140 CAIRO_FORMAT_ARGB32,1140 CAIRO_FORMAT_ARGB32,
@@ -1173,6 +1173,8 @@
1173 EM2PIXELS (defaults_get_gauge_outline_width (d), d));1173 EM2PIXELS (defaults_get_gauge_outline_width (d), d));
11741174
1175 // create the surface/blur-cache from the normal surface1175 // create the surface/blur-cache from the normal surface
1176 if (priv->tile_indicator)
1177 tile_destroy (priv->tile_indicator);
1176 priv->tile_indicator = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);1178 priv->tile_indicator = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);
11771179
1178 // clean up1180 // clean up
@@ -2185,12 +2187,18 @@
21852187
2186 priv = GET_PRIVATE (self);2188 priv = GET_PRIVATE (self);
21872189
2188 tile_destroy (priv->tile_background_part);2190 if (priv->tile_background_part)
2189 tile_destroy (priv->tile_background);2191 tile_destroy (priv->tile_background_part);
2190 tile_destroy (priv->tile_icon);2192 if (priv->tile_background)
2191 tile_destroy (priv->tile_title);2193 tile_destroy (priv->tile_background);
2192 tile_destroy (priv->tile_body);2194 if (priv->tile_icon)
2193 tile_destroy (priv->tile_indicator);2195 tile_destroy (priv->tile_icon);
2196 if (priv->tile_title)
2197 tile_destroy (priv->tile_title);
2198 if (priv->tile_body)
2199 tile_destroy (priv->tile_body);
2200 if (priv->tile_indicator)
2201 tile_destroy (priv->tile_indicator);
21942202
2195 g_object_unref (self);2203 g_object_unref (self);
2196}2204}

Subscribers

People subscribed via source and target branches