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
1=== modified file 'src/bubble.c'
2--- src/bubble.c 2009-07-27 11:09:11 +0000
3+++ src/bubble.c 2009-07-27 15:45:27 +0000
4@@ -638,8 +638,6 @@
5 gint width;
6 gint height;
7
8- tile_destroy (priv->tile_background);
9-
10 bubble_get_size (self, &width, &height);
11
12 // create temp. scratch surface for top-left shadow/background part
13@@ -753,6 +751,8 @@
14 cairo_surface_destroy (clone);
15
16 // finally create tile with top-left shadow/background part
17+ if (priv->tile_background_part)
18+ tile_destroy (priv->tile_background_part);
19 priv->tile_background_part = tile_new_for_padding (normal, blurred);
20 cairo_surface_destroy (normal);
21 cairo_surface_destroy (blurred);
22@@ -850,6 +850,8 @@
23 cairo_destroy (cr);
24
25 // finally create tile for full background
26+ if (priv->tile_background)
27+ tile_destroy (priv->tile_background);
28 if (priv->composited)
29 priv->tile_background = tile_new_for_padding (normal, blurred);
30 else
31@@ -870,8 +872,6 @@
32 cairo_surface_t* normal = NULL;
33 cairo_t* cr = NULL;
34
35- tile_destroy (priv->tile_icon);
36-
37 if (!priv->icon_pixbuf)
38 return;
39
40@@ -907,6 +907,8 @@
41 cairo_paint (cr);
42
43 // create the surface/blur-cache from the normal surface
44+ if (priv->tile_icon)
45+ tile_destroy (priv->tile_icon);
46 priv->tile_icon = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);
47
48 // clean up
49@@ -925,8 +927,6 @@
50 PangoLayout* layout = NULL;
51 raico_blur_t* blur = NULL;
52
53- tile_destroy (priv->tile_title);
54-
55 // create temp. scratch surface
56 normal = cairo_image_surface_create (
57 CAIRO_FORMAT_ARGB32,
58@@ -1011,6 +1011,8 @@
59 g_object_unref (layout);
60
61 // create the surface/blur-cache from the normal surface
62+ if (priv->tile_title)
63+ tile_destroy (priv->tile_title);
64 priv->tile_title = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);
65
66 // clean up
67@@ -1029,8 +1031,6 @@
68 PangoLayout* layout = NULL;
69 raico_blur_t* blur = NULL;
70
71- tile_destroy (priv->tile_body);
72-
73 // create temp. scratch surface
74 normal = cairo_image_surface_create (
75 CAIRO_FORMAT_ARGB32,
76@@ -1118,6 +1118,8 @@
77 g_object_unref (layout);
78
79 // create the surface/blur-cache from the normal surface
80+ if (priv->tile_body)
81+ tile_destroy (priv->tile_body);
82 priv->tile_body = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);
83
84 // clean up
85@@ -1133,8 +1135,6 @@
86 cairo_surface_t* normal = NULL;
87 cairo_t* cr = NULL;
88
89- tile_destroy (priv->tile_indicator);
90-
91 // create temp. scratch surface
92 normal = cairo_image_surface_create (
93 CAIRO_FORMAT_ARGB32,
94@@ -1173,6 +1173,8 @@
95 EM2PIXELS (defaults_get_gauge_outline_width (d), d));
96
97 // create the surface/blur-cache from the normal surface
98+ if (priv->tile_indicator)
99+ tile_destroy (priv->tile_indicator);
100 priv->tile_indicator = tile_new (normal, BUBBLE_CONTENT_BLUR_RADIUS);
101
102 // clean up
103@@ -2185,12 +2187,18 @@
104
105 priv = GET_PRIVATE (self);
106
107- tile_destroy (priv->tile_background_part);
108- tile_destroy (priv->tile_background);
109- tile_destroy (priv->tile_icon);
110- tile_destroy (priv->tile_title);
111- tile_destroy (priv->tile_body);
112- tile_destroy (priv->tile_indicator);
113+ if (priv->tile_background_part)
114+ tile_destroy (priv->tile_background_part);
115+ if (priv->tile_background)
116+ tile_destroy (priv->tile_background);
117+ if (priv->tile_icon)
118+ tile_destroy (priv->tile_icon);
119+ if (priv->tile_title)
120+ tile_destroy (priv->tile_title);
121+ if (priv->tile_body)
122+ tile_destroy (priv->tile_body);
123+ if (priv->tile_indicator)
124+ tile_destroy (priv->tile_indicator);
125
126 g_object_unref (self);
127 }

Subscribers

People subscribed via source and target branches