Merge lp:~agateau/unity-2d/check-indicator-loaded into lp:unity-2d/3.0

Proposed by Aurélien Gâteau
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 496
Merged at revision: 500
Proposed branch: lp:~agateau/unity-2d/check-indicator-loaded
Merge into: lp:unity-2d/3.0
Diff against target: 27 lines (+8/-1)
1 file modified
panel/applets/indicator/indicator.c (+8/-1)
To merge this branch: bzr merge lp:~agateau/unity-2d/check-indicator-loaded
Reviewer Review Type Date Requested Status
Olivier Tilloy (community) Approve
Review via email: mp+55562@code.launchpad.net

Commit message

[panel] Check pointer returned by indicator_object_new_from_file() is correct and log error if not.

Description of the change

Don't assume indicator_object_new_from_file() never fails.

To test it:

- sudo touch /usr/lib/indicators/5/libcrash.so
- Restart panel, it should not crash.

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

I cannot reproduce the crash before merging your work, even with a fake empty indicator module as suggested.

However, the changes in this branch are sound and make perfect sense regarding libindicator’s documentation, so let’s merge them: better safe than sorry.

Whether that fixes the original crash reported as bug #727483, I don’t know…

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panel/applets/indicator/indicator.c'
2--- panel/applets/indicator/indicator.c 2011-03-09 15:44:01 +0000
3+++ panel/applets/indicator/indicator.c 2011-03-30 14:58:25 +0000
4@@ -343,6 +343,7 @@
5 gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
6 IndicatorObject * io = indicator_object_new_from_file(fullpath);
7 g_free(fullpath);
8+ g_return_val_if_fail(io != NULL, FALSE);
9
10 /* Attach the 'name' to the object */
11 g_object_set_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER, GINT_TO_POINTER(name2order(name)));
12@@ -438,8 +439,14 @@
13
14 dir = g_dir_open(INDICATOR_DIR, 0, NULL);
15 while ((name = g_dir_read_name (dir)) != NULL) {
16- if ((g_strcmp0(name, "libappmenu.so") != 0) && load_module(name, indicator->menu)) {
17+ if (g_strcmp0(name, "libappmenu.so") == 0) {
18+ continue;
19+ }
20+
21+ if (load_module(name, indicator->menu)) {
22 indicators_loaded++;
23+ } else {
24+ g_warning("Failed to load module %s", name);
25 }
26 }
27 g_dir_close(dir);

Subscribers

People subscribed via source and target branches