Merge lp:~boiko/telephony-service/rtm-dont_crash_no_dbus into lp:telephony-service/rtm-14.09

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Bill Filler
Approved revision: 908
Merged at revision: 907
Proposed branch: lp:~boiko/telephony-service/rtm-dont_crash_no_dbus
Merge into: lp:telephony-service/rtm-14.09
Diff against target: 76 lines (+20/-14)
2 files modified
libtelephonyservice/telepathyhelper.cpp (+19/-13)
libtelephonyservice/telepathyhelper.h (+1/-1)
To merge this branch: bzr merge lp:~boiko/telephony-service/rtm-dont_crash_no_dbus
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
Review via email: mp+240717@code.launchpad.net

Commit message

Do not crash if the account manager preparation job does not succeed.

Description of the change

Do not crash if the account manager preparation job does not succeed.

== Checklist ==
Are there any related MPs required for this MP to build/function as expected? Please list.
No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/<package-name>) on device or emulator?
Yes

If you changed the UI, was the change specified/approved by design?
N//A

If you changed UI labels, did you update the pot file?
N/A

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
N/A

To post a comment you must log in.
908. By Gustavo Pichorim Boiko

Do not try to connect signals of an observer that didn't get registered.

Revision history for this message
Bill Filler (bfiller) wrote :

approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libtelephonyservice/telepathyhelper.cpp'
2--- libtelephonyservice/telepathyhelper.cpp 2014-10-04 02:23:07 +0000
3+++ libtelephonyservice/telepathyhelper.cpp 2014-11-05 20:43:30 +0000
4@@ -201,17 +201,17 @@
5 }
6
7 mChannelObserver = new ChannelObserver(this);
8- registerClient(mChannelObserver, name);
9-
10- // messages
11- connect(mChannelObserver, SIGNAL(textChannelAvailable(Tp::TextChannelPtr)),
12- ChatManager::instance(), SLOT(onTextChannelAvailable(Tp::TextChannelPtr)));
13-
14- // calls
15- connect(mChannelObserver, SIGNAL(callChannelAvailable(Tp::CallChannelPtr)),
16- CallManager::instance(), SLOT(onCallChannelAvailable(Tp::CallChannelPtr)));
17-
18- Q_EMIT channelObserverCreated(mChannelObserver);
19+ if (registerClient(mChannelObserver, name)) {
20+ // messages
21+ connect(mChannelObserver, SIGNAL(textChannelAvailable(Tp::TextChannelPtr)),
22+ ChatManager::instance(), SLOT(onTextChannelAvailable(Tp::TextChannelPtr)));
23+
24+ // calls
25+ connect(mChannelObserver, SIGNAL(callChannelAvailable(Tp::CallChannelPtr)),
26+ CallManager::instance(), SLOT(onCallChannelAvailable(Tp::CallChannelPtr)));
27+
28+ Q_EMIT channelObserverCreated(mChannelObserver);
29+ }
30 }
31
32 void TelepathyHelper::unregisterChannelObserver()
33@@ -245,7 +245,7 @@
34 SLOT(onAccountReady()));
35 }
36
37-void TelepathyHelper::registerClient(Tp::AbstractClient *client, QString name)
38+bool TelepathyHelper::registerClient(Tp::AbstractClient *client, QString name)
39 {
40 Tp::AbstractClientPtr clientPtr(client);
41 bool succeeded = mClientRegistrar->registerClient(clientPtr, name);
42@@ -267,6 +267,8 @@
43 object->setProperty("clientName", TP_QT_IFACE_CLIENT + "." + name );
44 }
45 }
46+
47+ return succeeded;
48 }
49
50 AccountEntry *TelepathyHelper::accountForConnection(const Tp::ConnectionPtr &connection) const
51@@ -329,7 +331,11 @@
52
53 void TelepathyHelper::onAccountManagerReady(Tp::PendingOperation *op)
54 {
55- Q_UNUSED(op)
56+ // if the account manager ready job returns an error, just fail silently
57+ if (op->isError()) {
58+ qCritical() << "Failed to prepare Tp::AccountManager" << op->errorName() << op->errorMessage();
59+ return;
60+ }
61
62 Tp::AccountSetPtr accountSet;
63 QMap<QString, AccountEntry *> orderedAccounts;
64
65=== modified file 'libtelephonyservice/telepathyhelper.h'
66--- libtelephonyservice/telepathyhelper.h 2014-09-29 23:09:25 +0000
67+++ libtelephonyservice/telepathyhelper.h 2014-11-05 20:43:30 +0000
68@@ -80,7 +80,7 @@
69 bool emergencyCallsAvailable() const;
70 Q_INVOKABLE void unlockSimCards() const;
71
72- void registerClient(Tp::AbstractClient *client, QString name);
73+ bool registerClient(Tp::AbstractClient *client, QString name);
74
75 // pre-populated channel class specs for conferences
76 static Tp::ChannelClassSpec audioConferenceSpec();

Subscribers

People subscribed via source and target branches