[telepathy-qt4/master] ChannelDispatchOperation: Let's not crash on buggy CD.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Mon Jun 1 22:45:44 PDT 2009
---
TelepathyQt4/channel-dispatch-operation.cpp | 29 ++++++++++++++++++++------
1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/TelepathyQt4/channel-dispatch-operation.cpp b/TelepathyQt4/channel-dispatch-operation.cpp
index a55ce98..b46ad28 100644
--- a/TelepathyQt4/channel-dispatch-operation.cpp
+++ b/TelepathyQt4/channel-dispatch-operation.cpp
@@ -175,7 +175,8 @@ void ChannelDispatchOperation::Private::extractMainProps(const QVariantMap &prop
void ChannelDispatchOperation::Private::checkReady()
{
- if (!connection->isReady() || !account->isReady()) {
+ if ((connection && !connection->isReady()) ||
+ (account && !account->isReady())) {
return;
}
@@ -300,17 +301,31 @@ void ChannelDispatchOperation::gotMainProperties(QDBusPendingCallWatcher *watche
mPriv->extractMainProps(props, false);
- connect(mPriv->connection->becomeReady(),
- SIGNAL(finished(Tp::PendingOperation *)),
- SLOT(onConnectionReady(Tp::PendingOperation *)));
- connect(mPriv->account->becomeReady(),
- SIGNAL(finished(Tp::PendingOperation *)),
- SLOT(onAccountReady(Tp::PendingOperation *)));
+ if (mPriv->connection) {
+ connect(mPriv->connection->becomeReady(),
+ SIGNAL(finished(Tp::PendingOperation *)),
+ SLOT(onConnectionReady(Tp::PendingOperation *)));
+ } else {
+ warning() << "Properties.GetAll(ChannelDispatchOperation) is missing "
+ "connection property, ignoring";
+ }
+
+ if (mPriv->account) {
+ connect(mPriv->account->becomeReady(),
+ SIGNAL(finished(Tp::PendingOperation *)),
+ SLOT(onAccountReady(Tp::PendingOperation *)));
+ } else {
+ warning() << "Properties.GetAll(ChannelDispatchOperation) is missing "
+ "account property, ignoring";
+ }
+
foreach (const ChannelPtr &channel, mPriv->channels) {
connect(channel->becomeReady(),
SIGNAL(finished(Tp::PendingOperation *)),
SLOT(onChannelReady(Tp::PendingOperation *)));
}
+
+ mPriv->checkReady();
}
else {
mPriv->readinessHelper->setIntrospectCompleted(FeatureCore,
--
1.5.6.5
More information about the telepathy-commits
mailing list