Merge lp:~attente/unity-gtk-module/1198471 into lp:unity-gtk-module/14.04

Proposed by William Hua
Status: Merged
Approved by: Lars Karlitski
Approved revision: 311
Merged at revision: 312
Proposed branch: lp:~attente/unity-gtk-module/1198471
Merge into: lp:unity-gtk-module/14.04
Diff against target: 45 lines (+5/-5)
2 files modified
lib/unity-gtk-action-group.c (+2/-2)
src/main.c (+3/-3)
To merge this branch: bzr merge lp:~attente/unity-gtk-module/1198471
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+196941@code.launchpad.net

Commit message

Relax the preconditions for disconnecting action groups from shells. (LP: #1198471)

If we have this situation:

  Menu A (action group G)
    Menu B (action group G)
      Menu C (action group G) <- about to be destroyed
        Menu D (action group G)
          Menu E (action group G)

and Menu C is destroyed, we get:

  Menu A (action group G)
    Menu B (action group G)
      Menu C (no action group)
        Menu D (no action group)
          Menu E (no action group)

So when Menu A is disconnected from G, this causes the warnings from LP: #1198471.

One thing we could have tried was just removing the tree rooted at Menu C, but then that would break removing the entire tree rooted at Menu A. Also, we'd have to end up doing this by having the Menu C unref itself.

It's really easiest to treat it as a dead sub-tree that will be finalized when the entire tree is finalized. Let's relax the preconditions on the unity_gtk_action_group_disconnect_item and unity_gtk_action_group_disconnect_shell functions, and allow the case where the shell's action group is already set to NULL.

Description of the change

Relax the preconditions for disconnecting action groups from shells. (LP: #1198471)

If we have this situation:

  Menu A (action group G)
    Menu B (action group G)
      Menu C (action group G) <- about to be destroyed
        Menu D (action group G)
          Menu E (action group G)

and Menu C is destroyed, we get:

  Menu A (action group G)
    Menu B (action group G)
      Menu C (no action group)
        Menu D (no action group)
          Menu E (no action group)

So when Menu A is disconnected from G, this causes the warnings from LP: #1198471.

One thing we could have tried was just removing the tree rooted at Menu C, but then that would break removing the entire tree rooted at Menu A. Also, we'd have to end up doing this by having the Menu C unref itself.

It's really easiest to treat it as a dead sub-tree that will be finalized when the entire tree is finalized. Let's relax the preconditions on the unity_gtk_action_group_disconnect_item and unity_gtk_action_group_disconnect_shell functions, and allow the case where the shell's action group is already set to NULL.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Lars Karlitski (larsu) wrote :

Makes sense to me. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/unity-gtk-action-group.c'
2--- lib/unity-gtk-action-group.c 2013-02-19 11:55:57 +0000
3+++ lib/unity-gtk-action-group.c 2013-11-27 16:49:57 +0000
4@@ -903,7 +903,7 @@
5
6 g_return_if_fail (UNITY_GTK_IS_ACTION_GROUP (group));
7 g_return_if_fail (UNITY_GTK_IS_MENU_ITEM (item));
8- g_warn_if_fail (item->parent_shell != NULL && item->parent_shell->action_group == group);
9+ g_warn_if_fail (item->parent_shell != NULL);
10
11 action = item->action;
12
13@@ -1027,7 +1027,7 @@
14
15 g_return_if_fail (UNITY_GTK_IS_ACTION_GROUP (group));
16 g_return_if_fail (UNITY_GTK_IS_MENU_SHELL (shell));
17- g_warn_if_fail (shell->action_group == group);
18+ g_warn_if_fail (shell->action_group == NULL || shell->action_group == group);
19
20 visible_indices = shell->visible_indices;
21
22
23=== modified file 'src/main.c'
24--- src/main.c 2013-11-15 19:54:04 +0000
25+++ src/main.c 2013-11-27 16:49:57 +0000
26@@ -613,9 +613,6 @@
27
28 g_return_if_fail (GTK_IS_MENU_BAR (widget));
29
30- if (pre_hijacked_menu_bar_unrealize != NULL)
31- (* pre_hijacked_menu_bar_unrealize) (widget);
32-
33 menu_shell_data = gtk_menu_shell_get_menu_shell_data (GTK_MENU_SHELL (widget));
34
35 if (menu_shell_data->settings_notify_gtk_shell_shows_menubar_handler_id)
36@@ -626,6 +623,9 @@
37
38 if (menu_shell_data->window != NULL)
39 gtk_window_disconnect_menu_shell (menu_shell_data->window, GTK_MENU_SHELL (widget));
40+
41+ if (pre_hijacked_menu_bar_unrealize != NULL)
42+ (* pre_hijacked_menu_bar_unrealize) (widget);
43 }
44
45 static void

Subscribers

People subscribed via source and target branches