Merge lp:~mterry/unity/851954 into lp:unity

Proposed by Michael Terry
Status: Merged
Approved by: Michal Hruby
Approved revision: no longer in the source branch.
Merged at revision: 1749
Proposed branch: lp:~mterry/unity/851954
Merge into: lp:unity
Diff against target: 26 lines (+8/-1)
1 file modified
services/panel-service.c (+8/-1)
To merge this branch: bzr merge lp:~mterry/unity/851954
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+81916@code.launchpad.net

Description of the change

In https://code.launchpad.net/~mterry/unity/never-stop-oh-never-stop-the-scrubbing/+merge/47581 I added this line:
          g_signal_connect (priv->last_menu, "deactivate", G_CALLBACK (gtk_widget_destroy), NULL);

But destroying the widget causes dispose to be run, and GtkMenuShell's dispose causes "deactivate" to run.

I'm pretty sure I tested this code and didn't get this behavior. So either this sequence changed or I'm misremembering. Regardless, it's like that now.

One fix is simply to disconnect the signal handler when we get that signal, done in this branch.

I'm not sure how to reproduce though. The related bug does not give useful information to get to this state. And the steps from my original merge don't work anymore, since indicator-appmenu is better these days. :-/

But the branch seems obviously correct to me.

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

Looks good to me, this should fix the issue.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'services/panel-service.c'
2--- services/panel-service.c 2011-10-13 16:46:47 +0000
3+++ services/panel-service.c 2011-11-10 22:09:25 +0000
4@@ -1349,6 +1349,13 @@
5 activate_next_prev_menu (self, object, priv->last_entry, direction);
6 }
7
8+static void
9+menu_deactivated (GtkWidget *menu)
10+{
11+ g_signal_handlers_disconnect_by_func (menu, menu_deactivated, NULL);
12+ gtk_widget_destroy (menu);
13+}
14+
15 void
16 panel_service_show_entry (PanelService *self,
17 const gchar *entry_id,
18@@ -1399,7 +1406,7 @@
19 stub menu for the duration of this scrub. */
20 priv->last_menu = GTK_MENU (gtk_menu_new ());
21 g_signal_connect (priv->last_menu, "deactivate",
22- G_CALLBACK (gtk_widget_destroy), NULL);
23+ G_CALLBACK (menu_deactivated), NULL);
24 g_signal_connect (priv->last_menu, "destroy",
25 G_CALLBACK (gtk_widget_destroyed), &priv->last_menu);
26 }