Merge lp:~3v1n0/compiz/gtk-decorator-finalize-menu-0.9.10 into lp:compiz/0.9.10

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Brandon Schaefer
Approved revision: 3793
Merged at revision: 3793
Proposed branch: lp:~3v1n0/compiz/gtk-decorator-finalize-menu-0.9.10
Merge into: lp:compiz/0.9.10
Diff against target: 101 lines (+16/-16)
3 files modified
gtk/window-decorator/actionmenu.c (+16/-6)
gtk/window-decorator/events.c (+0/-8)
gtk/window-decorator/wnck.c (+0/-2)
To merge this branch: bzr merge lp:~3v1n0/compiz/gtk-decorator-finalize-menu-0.9.10
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+188124@code.launchpad.net

Commit message

ActionMenu: weak ref the action menu on creation, and unref it on destroy

Also, now the widget destruction automatically unset the menu.
This makes the object to be correctly finalized (not only disposed) making sure
the internal idle into WnckActionMenu gets stopped.

Description of the change

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gtk/window-decorator/actionmenu.c'
--- gtk/window-decorator/actionmenu.c 2012-11-09 01:21:17 +0000
+++ gtk/window-decorator/actionmenu.c 2013-09-27 18:18:05 +0000
@@ -28,6 +28,16 @@
28}28}
2929
30static void30static void
31action_menu_destroyed (GObject *object)
32{
33 g_signal_handlers_disconnect_by_func (action_menu, action_menu_destroyed, NULL);
34 g_signal_handlers_disconnect_by_func (action_menu, action_menu_unmap, NULL);
35 g_object_unref (action_menu);
36 action_menu = NULL;
37 action_menu_mapped = FALSE;
38}
39
40static void
31position_action_menu (GtkMenu *menu,41position_action_menu (GtkMenu *menu,
32 gint *x,42 gint *x,
33 gint *y,43 gint *y,
@@ -77,8 +87,6 @@
77 if (action_menu_mapped)87 if (action_menu_mapped)
78 {88 {
79 gtk_widget_destroy (action_menu);89 gtk_widget_destroy (action_menu);
80 action_menu_mapped = FALSE;
81 action_menu = NULL;
82 return;90 return;
83 }91 }
84 else92 else
@@ -105,13 +113,15 @@
105 break;113 break;
106 }114 }
107115
108 action_menu = wnck_create_window_action_menu (win);116 action_menu = wnck_action_menu_new (win);
117 g_object_ref_sink (action_menu);
109118
110 gtk_menu_set_screen (GTK_MENU (action_menu), screen);119 gtk_menu_set_screen (GTK_MENU (action_menu), screen);
111120
112 g_signal_connect_object (G_OBJECT (action_menu), "unmap",121 g_signal_connect (G_OBJECT (action_menu), "destroy",
113 G_CALLBACK (action_menu_unmap),122 G_CALLBACK (action_menu_destroyed), NULL);
114 0, 0);123 g_signal_connect (G_OBJECT (action_menu), "unmap",
124 G_CALLBACK (action_menu_unmap), NULL);
115125
116 gtk_widget_show (action_menu);126 gtk_widget_show (action_menu);
117127
118128
=== modified file 'gtk/window-decorator/events.c'
--- gtk/window-decorator/events.c 2013-05-15 22:50:49 +0000
+++ gtk/window-decorator/events.c 2013-09-27 18:18:05 +0000
@@ -45,8 +45,6 @@
45 if (action_menu_mapped)45 if (action_menu_mapped)
46 {46 {
47 gtk_object_destroy (GTK_OBJECT (action_menu));47 gtk_object_destroy (GTK_OBJECT (action_menu));
48 action_menu_mapped = FALSE;
49 action_menu = NULL;
50 return;48 return;
51 }49 }
5250
@@ -137,8 +135,6 @@
137 if (action_menu_mapped && gtkwd_type == GButtonPress)135 if (action_menu_mapped && gtkwd_type == GButtonPress)
138 {136 {
139 gtk_object_destroy (GTK_OBJECT (action_menu));137 gtk_object_destroy (GTK_OBJECT (action_menu));
140 action_menu_mapped = FALSE;
141 action_menu = NULL;
142 }138 }
143139
144 common_button_event (win, gtkwd_event, gtkwd_type,140 common_button_event (win, gtkwd_event, gtkwd_type,
@@ -166,8 +162,6 @@
166 if (action_menu_mapped && gtkwd_type == GButtonPress)162 if (action_menu_mapped && gtkwd_type == GButtonPress)
167 {163 {
168 gtk_object_destroy (GTK_OBJECT (action_menu));164 gtk_object_destroy (GTK_OBJECT (action_menu));
169 action_menu_mapped = FALSE;
170 action_menu = NULL;
171 }165 }
172166
173 if (wnck_window_is_maximized (win))167 if (wnck_window_is_maximized (win))
@@ -227,8 +221,6 @@
227 if (action_menu_mapped && gtkwd_type == GButtonPress)221 if (action_menu_mapped && gtkwd_type == GButtonPress)
228 {222 {
229 gtk_object_destroy (GTK_OBJECT (action_menu));223 gtk_object_destroy (GTK_OBJECT (action_menu));
230 action_menu_mapped = FALSE;
231 action_menu = NULL;
232 }224 }
233225
234 common_button_event (win, gtkwd_event, gtkwd_type,226 common_button_event (win, gtkwd_event, gtkwd_type,
235227
=== modified file 'gtk/window-decorator/wnck.c'
--- gtk/window-decorator/wnck.c 2013-05-13 15:39:25 +0000
+++ gtk/window-decorator/wnck.c 2013-09-27 18:18:05 +0000
@@ -255,8 +255,6 @@
255 if (action_menu_mapped)255 if (action_menu_mapped)
256 {256 {
257 gtk_object_destroy (GTK_OBJECT (action_menu));257 gtk_object_destroy (GTK_OBJECT (action_menu));
258 action_menu_mapped = FALSE;
259 action_menu = NULL;
260 return;258 return;
261 }259 }
262260

Subscribers

People subscribed via source and target branches