Merge lp:~mhr3/libunity/fix-1219792 into lp:libunity

Proposed by Michal Hruby
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 288
Merged at revision: 288
Proposed branch: lp:~mhr3/libunity/fix-1219792
Merge into: lp:libunity
Diff against target: 75 lines (+19/-18)
1 file modified
tools/unity-tool.vala (+19/-18)
To merge this branch: bzr merge lp:~mhr3/libunity/fix-1219792
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+183437@code.launchpad.net

Commit message

Make sure libunity-tool doesn't crash when it can't connect to the bus

Description of the change

Make sure libunity-tool doesn't crash when it can't connect to the bus.

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
Paweł Stołowski (stolowski) wrote :

LGTM. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/unity-tool.vala'
2--- tools/unity-tool.vala 2013-04-03 11:30:10 +0000
3+++ tools/unity-tool.vala 2013-09-02 11:46:25 +0000
4@@ -215,24 +215,17 @@
5
6 if (Options.benchmark)
7 {
8- try
9- {
10- // libunity uses an envvar to add time information, tell dbus
11- // to use that envvar for newly spawned services
12- var conn = Bus.get_sync (BusType.SESSION, null);
13- var env = new HashTable<string, string> (str_hash, str_equal);
14- env["LIBUNITY_TIME_SEARCHES"] = "1";
15- conn.call_sync ("org.freedesktop.DBus",
16- "/org/freedesktop/DBus",
17- "org.freedesktop.DBus",
18- "UpdateActivationEnvironment",
19- new Variant.tuple ({env}),
20- null, 0, -1, null);
21- }
22- catch (Error e)
23- {
24- warning ("%s", e.message);
25- }
26+ // libunity uses an envvar to add time information, tell dbus
27+ // to use that envvar for newly spawned services
28+ var conn = Bus.get_sync (BusType.SESSION, null);
29+ var env = new HashTable<string, string> (str_hash, str_equal);
30+ env["LIBUNITY_TIME_SEARCHES"] = "1";
31+ conn.call_sync ("org.freedesktop.DBus",
32+ "/org/freedesktop/DBus",
33+ "org.freedesktop.DBus",
34+ "UpdateActivationEnvironment",
35+ new Variant.tuple ({env}),
36+ null, 0, -1, null);
37 }
38
39 // Get proxy
40@@ -330,6 +323,7 @@
41 ChannelFlags channel_flags,
42 out string channel_id,
43 out Dee.SerializableModel model)
44+ throws Error
45 {
46 ScopeProxy? proxy = null;
47 var ml = new MainLoop ();
48@@ -346,9 +340,14 @@
49 ml.quit ();
50 });
51 run_with_timeout (ml, 15000);
52+ if (proxy == null)
53+ {
54+ throw new IOError.TIMED_OUT ("Timed out waiting for proxy");
55+ }
56
57 ml = new MainLoop ();
58 string? chan_id = null;
59+ Error? outer_error = null;
60 Dee.SerializableModel? results_model = null;
61 proxy.open_channel.begin (channel_type, channel_flags, null, (obj, res) =>
62 {
63@@ -359,10 +358,12 @@
64 catch (Error err)
65 {
66 warning ("%s", err.message);
67+ outer_error = err;
68 }
69 ml.quit ();
70 });
71 run_with_timeout (ml, 15000);
72+ if (outer_error != null) throw outer_error;
73
74 channel_id = chan_id;
75 model = results_model;

Subscribers

People subscribed via source and target branches