[next] telepathy-glib: TpTestsTextChannelGroup: don' t reinvent TpBaseChannel close functionality

Simon McVittie smcv at kemper.freedesktop.org
Tue Mar 18 05:45:05 PDT 2014


Module: telepathy-glib
Branch: next
Commit: 123fbaeccc96c71acefe3ecc0c3de1c298796d28
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=123fbaeccc96c71acefe3ecc0c3de1c298796d28

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Mar 14 18:46:09 2014 +0000

TpTestsTextChannelGroup: don't reinvent TpBaseChannel close functionality

This results in the channel emitting Closed twice during teardown,
which can result in the cli-group regression test failing under
GDBus when the second emission is received by a subsequent test-case.

---

 tests/lib/textchan-group.c |   49 ++------------------------------------------
 1 file changed, 2 insertions(+), 47 deletions(-)

diff --git a/tests/lib/textchan-group.c b/tests/lib/textchan-group.c
index f955240..7975b0f 100644
--- a/tests/lib/textchan-group.c
+++ b/tests/lib/textchan-group.c
@@ -97,17 +97,7 @@ remove_with_reason (GObject *obj,
   if (handle == group->self_handle)
     {
       /* User wants to leave */
-      if (!self->priv->closed)
-        {
-          DEBUG ("closed");
-          self->priv->closed = TRUE;
-          tp_svc_channel_emit_closed (self);
-        }
-      else
-        {
-          DEBUG ("already closed");
-        }
-
+      tp_base_channel_destroyed (TP_BASE_CHANNEL (self));
       return TRUE;
     }
 
@@ -175,29 +165,6 @@ constructed (GObject *object)
 }
 
 static void
-dispose (GObject *object)
-{
-  TpTestsTextChannelGroup *self = TP_TESTS_TEXT_CHANNEL_GROUP (object);
-
-  if (self->priv->disposed)
-    return;
-
-  self->priv->disposed = TRUE;
-
-  if (!self->priv->closed)
-    {
-      DEBUG ("closed");
-      tp_svc_channel_emit_closed (self);
-    }
-  else
-    {
-      DEBUG ("already closed");
-    }
-
-  ((GObjectClass *) tp_tests_text_channel_group_parent_class)->dispose (object);
-}
-
-static void
 finalize (GObject *object)
 {
   TpTestsTextChannelGroup *self = TP_TESTS_TEXT_CHANNEL_GROUP (object);
@@ -213,18 +180,7 @@ finalize (GObject *object)
 static void
 channel_close (TpBaseChannel *base)
 {
-  TpTestsTextChannelGroup *self = TP_TESTS_TEXT_CHANNEL_GROUP (base);
-
-  if (!self->priv->closed)
-    {
-      DEBUG ("closed");
-      self->priv->closed = TRUE;
-      tp_svc_channel_emit_closed (self);
-    }
-  else
-    {
-      DEBUG ("already closed");
-    }
+  tp_base_channel_destroyed (base);
 }
 
 static void
@@ -236,7 +192,6 @@ tp_tests_text_channel_group_class_init (TpTestsTextChannelGroupClass *klass)
   g_type_class_add_private (klass, sizeof (TpTestsTextChannelGroupPrivate));
 
   object_class->constructed = constructed;
-  object_class->dispose = dispose;
   object_class->finalize = finalize;
 
   base_class->channel_type = TP_IFACE_CHANNEL_TYPE_TEXT;



More information about the telepathy-commits mailing list