Merge lp:~3v1n0/unity/ups-fix-a11y-entry-crash into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Didier Roche-Tolomelli
Approved revision: no longer in the source branch.
Merged at revision: 2145
Proposed branch: lp:~3v1n0/unity/ups-fix-a11y-entry-crash
Merge into: lp:unity
Diff against target: 52 lines (+16/-3)
3 files modified
manual-tests/PanelService.txt (+12/-0)
services/panel-indicator-entry-accessible.c (+3/-2)
services/panel-service.c (+1/-1)
To merge this branch: bzr merge lp:~3v1n0/unity/ups-fix-a11y-entry-crash
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Review via email: mp+98455@code.launchpad.net

Commit message

unity-panel-service: don't crash if the parsed a11y indicator entry is not valid

Entries with invalid parent_object have been removed from the indicator
so we shouldn't really care about them.

Description of the change

PanelindicatorEntryAccessible: don't crash if the parsed entry is not valid

Entries with invalid parent_object have been removed from the indicator
so we shouldn't really care about them. It's up to the single indicators to correctly emit the entry-added/removed signals, but the panel service shouldn't be so fragile to crash if these entries are no longer valid.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

The code looks fine. Can we look to get the test from the bug report into the test suite please?

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Approving on behalf of Tim

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'manual-tests/PanelService.txt'
2--- manual-tests/PanelService.txt 1970-01-01 00:00:00 +0000
3+++ manual-tests/PanelService.txt 2012-03-21 10:56:22 +0000
4@@ -0,0 +1,12 @@
5+Panel Service doesn't crash with a11y
6+-------------------------------------
7+
8+#. Start with a clean screen
9+#. Save this python script and run it http://paste.ubuntu.com/893441/
10+
11+Outcome:
12+ The test should open the Software Center, move to the accessories and then
13+ close it again, during this process the the panel service shouldn't crash.
14+ This means that the menus and indicators must not be removed and readded
15+ from the unity panel.
16+ For more info see bug #937119
17
18=== modified file 'services/panel-indicator-entry-accessible.c'
19--- services/panel-indicator-entry-accessible.c 2012-02-24 01:14:20 +0000
20+++ services/panel-indicator-entry-accessible.c 2012-03-21 10:56:22 +0000
21@@ -252,7 +252,8 @@
22 g_return_val_if_fail (PANEL_IS_INDICATOR_ENTRY_ACCESSIBLE (accessible), 0);
23
24 piea = PANEL_INDICATOR_ENTRY_ACCESSIBLE (accessible);
25- if (GTK_IS_MENU (piea->priv->entry->menu))
26+
27+ if (piea->priv->entry->parent_object && GTK_IS_MENU (piea->priv->entry->menu))
28 n_children = 1;
29
30 return n_children;
31@@ -267,7 +268,7 @@
32 g_return_val_if_fail (PANEL_IS_INDICATOR_ENTRY_ACCESSIBLE (accessible), NULL);
33
34 piea = PANEL_INDICATOR_ENTRY_ACCESSIBLE (accessible);
35- if (GTK_IS_MENU (piea->priv->entry->menu))
36+ if (piea->priv->entry->parent_object && GTK_IS_MENU (piea->priv->entry->menu))
37 {
38 child = gtk_widget_get_accessible (GTK_WIDGET (piea->priv->entry->menu));
39 atk_object_set_parent (child, accessible);
40
41=== modified file 'services/panel-service.c'
42--- services/panel-service.c 2012-03-20 13:02:04 +0000
43+++ services/panel-service.c 2012-03-21 10:56:22 +0000
44@@ -390,7 +390,7 @@
45 }
46
47 if (event->evtype == XI_ButtonRelease)
48- {
49+ {
50 IndicatorObjectEntry *entry;
51 gboolean event_is_a_click = FALSE;
52 entry = get_entry_at (self, event->root_x, event->root_y);