Merge lp://staging/~charlesk/indicator-sound/lp-1427708-demote-error-to-warning into lp://staging/indicator-sound/15.04

Proposed by Charles Kerr
Status: Merged
Approved by: Ted Gould
Approved revision: 488
Merged at revision: 486
Proposed branch: lp://staging/~charlesk/indicator-sound/lp-1427708-demote-error-to-warning
Merge into: lp://staging/indicator-sound/15.04
Diff against target: 117 lines (+40/-34)
1 file modified
src/main.c (+40/-34)
To merge this branch: bzr merge lp://staging/~charlesk/indicator-sound/lp-1427708-demote-error-to-warning
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Ted Gould (community) Approve
Review via email: mp+252172@code.staging.launchpad.net

Commit message

Exit more gracefully on startup when the session bus can't be found.

Description of the change

Removes the extra bus-fetching sync call on startup in main().

This effectively leaves "can't get the bus" error reporting to g_bus_own_name()'s name_lost_handler, which in this patch is a g_warning() instead of g_error() s.t. we don't have as many crash-on-startup errors reported such as bug #1427708. This is the same approach that other indicators take.

Tested on vivd mako r124

To test:
$ stop indicator-datetime
$ DBUS_SESSION_BUS_ADDRESS=/dev/null /path/to/indicator-sound-service

Result should be the app does not crash; rather, it exits after giving a warning such as "indicator-sound-WARNING **: Name lost or unable to acquire bus: com.canonical.indicator.sound"

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ted Gould (ted) wrote :

So we don't want to use own_name like that because we want to ensure that we export our objects onto the bus before we request the name, that way we don't get a race with other folks who might be looking out for us getting the name. Creating the service object is what exports all of our stuff into the bus, so that's why it is done before requesting the name.

review: Needs Fixing
Revision history for this message
Charles Kerr (charlesk) wrote :

Of course, we've got to do it before the name_acquired_handler.

I've revised the MP to do the export in the bus_acquired_handler. This makes the patch a little larger than reverting to trunk + changing g_error() to g_warning + return 0, but elminates a redundant sync call and follows the standard g_bus_own_name() idoms.

487. By Charles Kerr

in main.c's g_bus_own_name() calls, move service creation/export to bus_acquired_handler to ensure that everything is exported onto the bus before name_acquired_handler is reached

488. By Charles Kerr

in main(), balance the notify_init() call with a notify_uninit() right before exiting

Revision history for this message
Ted Gould (ted) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches