[next] telepathy-glib: tp_svc_interface_skeleton_emit_signal: ignore if no longer exported

Simon McVittie smcv at kemper.freedesktop.org
Wed May 7 02:18:23 PDT 2014


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

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Apr 11 13:04:18 2014 +0100

tp_svc_interface_skeleton_emit_signal: ignore if no longer exported

Because GDBusObjectSkeleton holds a ref to all its interface skeletons
as long as the parent object exists, it's possible that they will
have been unexported but not freed.

Reviewed-by: Xavier Claessens <xavier.claessens at collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77189

---

 telepathy-glib/svc-interface-skeleton.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/telepathy-glib/svc-interface-skeleton.c b/telepathy-glib/svc-interface-skeleton.c
index 246baac..9a2a920 100644
--- a/telepathy-glib/svc-interface-skeleton.c
+++ b/telepathy-glib/svc-interface-skeleton.c
@@ -220,6 +220,8 @@ tp_svc_interface_skeleton_emit_signal (GClosure *closure,
   SignalClosure *sc = (SignalClosure *) closure;
   TpSvcInterfaceSkeleton *self = sc->self;
   GDBusInterfaceSkeleton *skel = G_DBUS_INTERFACE_SKELETON (self);
+  GDBusConnection *connection =
+    g_dbus_interface_skeleton_get_connection (skel);
   const gchar *path = g_dbus_interface_skeleton_get_object_path (skel);
   GVariantBuilder builder;
   guint i;
@@ -227,6 +229,12 @@ tp_svc_interface_skeleton_emit_signal (GClosure *closure,
   DEBUG ("%s.%s from %s %p", self->priv->iinfo->interface_info->name,
       sc->name, path, self);
 
+  if (path == NULL || connection == NULL)
+    {
+      DEBUG ("- ignoring, object no longer exported");
+      return;
+    }
+
   g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
 
   /* Skip parameter 0, which is the GObject. */
@@ -235,10 +243,9 @@ tp_svc_interface_skeleton_emit_signal (GClosure *closure,
         dbus_g_value_build_g_variant (param_values + i));
 
   /* we only support being exported on one connection */
-  g_dbus_connection_emit_signal (
-      g_dbus_interface_skeleton_get_connection (skel),
+  g_dbus_connection_emit_signal (connection,
       NULL, /* broadcast */
-      g_dbus_interface_skeleton_get_object_path (skel),
+      path,
       self->priv->iinfo->interface_info->name,
       sc->name,
       /* consume floating ref */



More information about the telepathy-commits mailing list