Merge lp:~charlesk/libdbusmenu/lp-1173262 into lp:libdbusmenu/13.10

Proposed by Charles Kerr
Status: Merged
Approved by: Mathieu Trudel-Lapierre
Approved revision: 442
Merged at revision: 442
Proposed branch: lp:~charlesk/libdbusmenu/lp-1173262
Merge into: lp:libdbusmenu/13.10
Diff against target: 58 lines (+21/-8)
1 file modified
libdbusmenu-gtk/client.c (+21/-8)
To merge this branch: bzr merge lp:~charlesk/libdbusmenu/lp-1173262
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+162246@code.launchpad.net

Commit message

In gtkclient's destructor, balance client's earlier gtk_widget_add_accelerator() calls with gtk_widget_remove_accelerator() calls.

Description of the change

The issue is that GtkMenus don't add a reference to the accelgroup that we feed it.

So in client's dispose(), we need to remove our accelgroup from all the widgets that we passed it to with gtk_widget_add_accelerator(). We do this by balancing those calls with gtk_widget_remove_accelerator() in client's dispose method.

After that, it's safe to unref our copy of accelgroup.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:442
http://jenkins.qa.ubuntu.com/job/libdbusmenu-ci/1/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/libdbusmenu-raring-amd64-ci/1

Click here to trigger a rebuild:
http://s-jenkins:8080/job/libdbusmenu-ci/1/rebuild

review: Approve (continuous-integration)
Revision history for this message
William Hua (attente) wrote :

Thanks, confirmed that this fixes the crash. Can you remove the part that prints 'hello world 6'?

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Needs Fixing so that we don't miss removing that hello world ;)

review: Needs Fixing
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

approving to unstuck this MR; I'll file another merge to get rid of the hello world.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbusmenu-gtk/client.c'
2--- libdbusmenu-gtk/client.c 2012-12-17 21:59:01 +0000
3+++ libdbusmenu-gtk/client.c 2013-05-02 21:10:45 +0000
4@@ -130,16 +130,32 @@
5 return;
6 }
7
8+static void
9+clear_shortcut_foreach (DbusmenuMenuitem *mi, gpointer gclient)
10+{
11+ guint key = 0;
12+ GtkMenuItem * gmi;
13+ GdkModifierType mod = 0;
14+ DbusmenuGtkClient * client = DBUSMENU_GTKCLIENT (gclient);
15+
16+ gmi = dbusmenu_gtkclient_menuitem_get (client, mi);
17+ dbusmenu_gtkclient_menuitem_get (client, mi);
18+ dbusmenu_menuitem_property_get_shortcut (mi, &key, &mod);
19+ if (key)
20+ gtk_widget_remove_accelerator (GTK_WIDGET (gmi), client->priv->agroup, key, mod);
21+}
22+
23 /* Just calling the super class. Future use. */
24 static void
25 dbusmenu_gtkclient_dispose (GObject *object)
26 {
27- DbusmenuGtkClientPrivate * priv = DBUSMENU_GTKCLIENT_GET_PRIVATE(object);
28+ DbusmenuMenuitem * root;
29+ DbusmenuGtkClientPrivate * priv = DBUSMENU_GTKCLIENT(object)->priv;
30
31- if (priv->agroup != NULL) {
32- g_object_unref(priv->agroup);
33- priv->agroup = NULL;
34- }
35+ if ((root = dbusmenu_client_get_root (DBUSMENU_CLIENT(object))))
36+ dbusmenu_menuitem_foreach (root, clear_shortcut_foreach, object);
37+ g_message ("hello world 6");
38+ g_clear_object (&priv->agroup);
39
40 if (priv->old_themedirs) {
41 remove_theme_dirs(gtk_icon_theme_get_default(), priv->old_themedirs);
42@@ -161,7 +177,6 @@
43 static void
44 dbusmenu_gtkclient_finalize (GObject *object)
45 {
46-
47 G_OBJECT_CLASS (dbusmenu_gtkclient_parent_class)->finalize (object);
48 return;
49 }
50@@ -361,8 +376,6 @@
51 static void
52 swap_agroup (DbusmenuMenuitem *mi, gpointer userdata) {
53 do_swap_agroup (mi, userdata);
54-
55- return; /* See what I did here, Ted? :) */
56 }
57
58 /* Refresh the shortcut for an entry */

Subscribers

People subscribed via source and target branches

to all changes: