telepathy-qt: BaseChannelGroupInterface::setSelfHandle(): Fixed possible crash.
Alexandr Akulich
kaffeine at kemper.freedesktop.org
Fri Dec 4 11:41:58 PST 2015
Module: telepathy-qt
Branch: master
Commit: 2f91be510529308c5ca08b479566fa4ca0212dde
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=2f91be510529308c5ca08b479566fa4ca0212dde
Author: Alexandr Akulich <akulichalexander at gmail.com>
Date: Sat Dec 5 00:28:45 2015 +0500
BaseChannelGroupInterface::setSelfHandle(): Fixed possible crash.
It's OK to set setSelfHandle() before the interface plug-in.
In this case the connection pointer is null and we can (more or
less) safely omit adaptee selfContactChanged() signal emission,
because there would be no listeners yet.
---
TelepathyQt/base-channel.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/TelepathyQt/base-channel.cpp b/TelepathyQt/base-channel.cpp
index a379439..717ab99 100644
--- a/TelepathyQt/base-channel.cpp
+++ b/TelepathyQt/base-channel.cpp
@@ -2397,11 +2397,13 @@ void BaseChannelGroupInterface::setSelfHandle(uint selfHandle)
// selfHandleChanged is deprecated since 0.23.4.
QMetaObject::invokeMethod(mPriv->adaptee, "selfHandleChanged", Q_ARG(uint, selfHandle)); //Can simply use emit in Qt5
- DBusError error;
- QStringList selfID = mPriv->connection->inspectHandles(Tp::HandleTypeContact, Tp::UIntList() << selfHandle, &error);
+ if (mPriv->connection) {
+ DBusError error;
+ QStringList selfID = mPriv->connection->inspectHandles(Tp::HandleTypeContact, Tp::UIntList() << selfHandle, &error);
- if (!selfID.isEmpty()) {
- QMetaObject::invokeMethod(mPriv->adaptee, "selfContactChanged", Q_ARG(uint, selfHandle), Q_ARG(QString, selfID.first())); //Can simply use emit in Qt5
+ if (!selfID.isEmpty()) {
+ QMetaObject::invokeMethod(mPriv->adaptee, "selfContactChanged", Q_ARG(uint, selfHandle), Q_ARG(QString, selfID.first())); //Can simply use emit in Qt5
+ }
}
}
More information about the telepathy-commits
mailing list