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
1=== modified file 'gtk/window-decorator/actionmenu.c'
2--- gtk/window-decorator/actionmenu.c 2012-11-09 01:21:17 +0000
3+++ gtk/window-decorator/actionmenu.c 2013-09-27 18:18:05 +0000
4@@ -28,6 +28,16 @@
5 }
6
7 static void
8+action_menu_destroyed (GObject *object)
9+{
10+ g_signal_handlers_disconnect_by_func (action_menu, action_menu_destroyed, NULL);
11+ g_signal_handlers_disconnect_by_func (action_menu, action_menu_unmap, NULL);
12+ g_object_unref (action_menu);
13+ action_menu = NULL;
14+ action_menu_mapped = FALSE;
15+}
16+
17+static void
18 position_action_menu (GtkMenu *menu,
19 gint *x,
20 gint *y,
21@@ -77,8 +87,6 @@
22 if (action_menu_mapped)
23 {
24 gtk_widget_destroy (action_menu);
25- action_menu_mapped = FALSE;
26- action_menu = NULL;
27 return;
28 }
29 else
30@@ -105,13 +113,15 @@
31 break;
32 }
33
34- action_menu = wnck_create_window_action_menu (win);
35+ action_menu = wnck_action_menu_new (win);
36+ g_object_ref_sink (action_menu);
37
38 gtk_menu_set_screen (GTK_MENU (action_menu), screen);
39
40- g_signal_connect_object (G_OBJECT (action_menu), "unmap",
41- G_CALLBACK (action_menu_unmap),
42- 0, 0);
43+ g_signal_connect (G_OBJECT (action_menu), "destroy",
44+ G_CALLBACK (action_menu_destroyed), NULL);
45+ g_signal_connect (G_OBJECT (action_menu), "unmap",
46+ G_CALLBACK (action_menu_unmap), NULL);
47
48 gtk_widget_show (action_menu);
49
50
51=== modified file 'gtk/window-decorator/events.c'
52--- gtk/window-decorator/events.c 2013-05-15 22:50:49 +0000
53+++ gtk/window-decorator/events.c 2013-09-27 18:18:05 +0000
54@@ -45,8 +45,6 @@
55 if (action_menu_mapped)
56 {
57 gtk_object_destroy (GTK_OBJECT (action_menu));
58- action_menu_mapped = FALSE;
59- action_menu = NULL;
60 return;
61 }
62
63@@ -137,8 +135,6 @@
64 if (action_menu_mapped && gtkwd_type == GButtonPress)
65 {
66 gtk_object_destroy (GTK_OBJECT (action_menu));
67- action_menu_mapped = FALSE;
68- action_menu = NULL;
69 }
70
71 common_button_event (win, gtkwd_event, gtkwd_type,
72@@ -166,8 +162,6 @@
73 if (action_menu_mapped && gtkwd_type == GButtonPress)
74 {
75 gtk_object_destroy (GTK_OBJECT (action_menu));
76- action_menu_mapped = FALSE;
77- action_menu = NULL;
78 }
79
80 if (wnck_window_is_maximized (win))
81@@ -227,8 +221,6 @@
82 if (action_menu_mapped && gtkwd_type == GButtonPress)
83 {
84 gtk_object_destroy (GTK_OBJECT (action_menu));
85- action_menu_mapped = FALSE;
86- action_menu = NULL;
87 }
88
89 common_button_event (win, gtkwd_event, gtkwd_type,
90
91=== modified file 'gtk/window-decorator/wnck.c'
92--- gtk/window-decorator/wnck.c 2013-05-13 15:39:25 +0000
93+++ gtk/window-decorator/wnck.c 2013-09-27 18:18:05 +0000
94@@ -255,8 +255,6 @@
95 if (action_menu_mapped)
96 {
97 gtk_object_destroy (GTK_OBJECT (action_menu));
98- action_menu_mapped = FALSE;
99- action_menu = NULL;
100 return;
101 }
102

Subscribers

People subscribed via source and target branches