telepathy-qt: BaseChannel: close() method extracted from Adaptee::close().

David Edmundson davidedmundson at kemper.freedesktop.org
Sun Aug 17 10:55:03 PDT 2014


Module: telepathy-qt
Branch: master
Commit: 20c5e719225c1a0a36113d7589acd1d15a6db0f9
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=20c5e719225c1a0a36113d7589acd1d15a6db0f9

Author: Alexandr Akulich <akulichalexander at gmail.com>
Date:   Sat Aug  9 00:56:28 2014 +0600

BaseChannel: close() method extracted from Adaptee::close().

Connection type changed from QueuedConnection to DirectConnection,
because close() method will be used in destructor.

---

 TelepathyQt/base-channel.cpp |   15 ++++++++-------
 TelepathyQt/base-channel.h   |    2 ++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/TelepathyQt/base-channel.cpp b/TelepathyQt/base-channel.cpp
index 972bfa1..1c20cca 100644
--- a/TelepathyQt/base-channel.cpp
+++ b/TelepathyQt/base-channel.cpp
@@ -89,13 +89,7 @@ QStringList BaseChannel::Adaptee::interfaces() const
 
 void BaseChannel::Adaptee::close(const Tp::Service::ChannelAdaptor::CloseContextPtr &context)
 {
-    //emit after return
-    QMetaObject::invokeMethod(this, "closed",
-                              Qt::QueuedConnection);
-    //emit after return
-    QMetaObject::invokeMethod(mChannel, "closed",
-                              Qt::QueuedConnection);
-
+    mChannel->close();
     context->setFinished();
 }
 
@@ -228,6 +222,13 @@ void BaseChannel::setRequested(bool requested)
     mPriv->requested = requested;
 }
 
+void BaseChannel::close()
+{
+    // Method is used in destructor, so (to be sure that adaptee is exists) we should use DirectConnection
+    QMetaObject::invokeMethod(mPriv->adaptee, "closed", Qt::DirectConnection);
+    emit closed();
+}
+
 /**
  * Return the immutable properties of this channel object.
  *
diff --git a/TelepathyQt/base-channel.h b/TelepathyQt/base-channel.h
index 261b1d1..c141df4 100644
--- a/TelepathyQt/base-channel.h
+++ b/TelepathyQt/base-channel.h
@@ -73,6 +73,8 @@ public:
     void setTargetID(const QString &targetID);
     void setRequested(bool requested);
 
+    void close();
+
     bool plugInterface(const AbstractChannelInterfacePtr &interface);
 
 Q_SIGNALS:



More information about the telepathy-commits mailing list