Merge lp:~vanvugt/compiz/fix-1057263 into lp:compiz/0.9.8

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3399
Merged at revision: 3401
Proposed branch: lp:~vanvugt/compiz/fix-1057263
Merge into: lp:compiz/0.9.8
Diff against target: 83 lines (+26/-3)
5 files modified
gtk/window-decorator/decorator.c (+10/-1)
gtk/window-decorator/events.c (+8/-1)
gtk/window-decorator/gtk-window-decorator.c (+1/-1)
gtk/window-decorator/gtk-window-decorator.h (+1/-0)
gtk/window-decorator/wnck.c (+6/-0)
To merge this branch: bzr merge lp:~vanvugt/compiz/fix-1057263
Reviewer Review Type Date Requested Status
Sam Spilsbury Approve
jenkins (community) continuous-integration Needs Fixing
Review via email: mp+126637@code.launchpad.net

Commit message

Some decoration pixmaps get leaked on window resize, due to race conditions
between gtk-window-decorator and the decor plugin.

That's a complex problem which requires a better interprocess communication
and resource ownership design. So I'm not trying to fix that directly.

Instead, what this does is limits pixmap leaks to the lifetime of the frame
window. So if any leaks do occur, they will be cleaned up and freed next
time the window is minimized or closed. Or to garbage collect for all windows,
just hit Ctrl+Alt+D twice.

(LP: #1057263)

Description of the change

See commit message.

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Approved because it makes sense but we should get to the bottom of this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gtk/window-decorator/decorator.c'
2--- gtk/window-decorator/decorator.c 2012-09-05 12:56:31 +0000
3+++ gtk/window-decorator/decorator.c 2012-09-27 09:12:24 +0000
4@@ -686,7 +686,16 @@
5
6 /* Destroy the old pixmaps and pictures */
7 if (d->pixmap)
8- g_hash_table_insert (destroyed_pixmaps_table, GINT_TO_POINTER (GDK_PIXMAP_XID (d->pixmap)), d->pixmap);
9+ {
10+ gpointer key = GINT_TO_POINTER (GDK_PIXMAP_XID (d->pixmap));
11+
12+ if (d->old_pixmaps == NULL)
13+ d->old_pixmaps = g_hash_table_new_full (NULL, NULL, NULL,
14+ g_object_unref);
15+
16+ g_hash_table_insert (destroyed_pixmaps_table, key, d);
17+ g_hash_table_insert (d->old_pixmaps, key, d->pixmap);
18+ }
19
20 if (d->buffer_pixmap)
21 g_object_unref (G_OBJECT (d->buffer_pixmap));
22
23=== modified file 'gtk/window-decorator/events.c'
24--- gtk/window-decorator/events.c 2012-08-28 04:45:17 +0000
25+++ gtk/window-decorator/events.c 2012-09-27 09:12:24 +0000
26@@ -1094,7 +1094,14 @@
27 }
28 else if (xevent->xclient.message_type == decor_delete_pixmap_atom)
29 {
30- g_hash_table_remove (destroyed_pixmaps_table, GINT_TO_POINTER (xevent->xclient.data.l[0]));
31+ gconstpointer key = GINT_TO_POINTER (xevent->xclient.data.l[0]);
32+ decor_t *d = g_hash_table_lookup (destroyed_pixmaps_table, key);
33+
34+ if (d != NULL)
35+ {
36+ g_hash_table_remove (d->old_pixmaps, key);
37+ g_hash_table_remove (destroyed_pixmaps_table, key);
38+ }
39 }
40 default:
41 break;
42
43=== modified file 'gtk/window-decorator/gtk-window-decorator.c'
44--- gtk/window-decorator/gtk-window-decorator.c 2012-09-08 00:00:34 +0000
45+++ gtk/window-decorator/gtk-window-decorator.c 2012-09-27 09:12:24 +0000
46@@ -342,7 +342,7 @@
47 xformat_rgb = XRenderFindStandardFormat (xdisplay, PictStandardRGB24);
48
49 frame_table = g_hash_table_new (NULL, NULL);
50- destroyed_pixmaps_table = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
51+ destroyed_pixmaps_table = g_hash_table_new (NULL, NULL);
52
53 if (!create_tooltip_window ())
54 {
55
56=== modified file 'gtk/window-decorator/gtk-window-decorator.h'
57--- gtk/window-decorator/gtk-window-decorator.h 2012-09-08 00:10:56 +0000
58+++ gtk/window-decorator/gtk-window-decorator.h 2012-09-27 09:12:24 +0000
59@@ -401,6 +401,7 @@
60 GtkWidget *decor_window;
61 GtkWidget *decor_event_box;
62 GtkWidget *decor_image;
63+ GHashTable *old_pixmaps;
64 cairo_t *cr;
65 decor_layout_t border_layout;
66 decor_context_t *context;
67
68=== modified file 'gtk/window-decorator/wnck.c'
69--- gtk/window-decorator/wnck.c 2012-09-26 11:36:12 +0000
70+++ gtk/window-decorator/wnck.c 2012-09-27 09:12:24 +0000
71@@ -497,6 +497,12 @@
72 d->buffer_pixmap = NULL;
73 }
74
75+ if (d->old_pixmaps)
76+ {
77+ g_hash_table_destroy (d->old_pixmaps);
78+ d->old_pixmaps = NULL;
79+ }
80+
81 if (d->cr)
82 {
83 cairo_destroy (d->cr);

Subscribers

People subscribed via source and target branches