diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-04-11 13:04:18 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-04-11 14:48:05 +0100 |
commit | ef3bd70fb326878f2d65ec59a03df72a415bbab6 (patch) | |
tree | 925701db2a88b23df1665222e88afbe40edbed4a | |
parent | 5c82dc0b3360bd612f905115ed23861df1ea3856 (diff) |
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.
-rw-r--r-- | telepathy-glib/svc-interface-skeleton.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/telepathy-glib/svc-interface-skeleton.c b/telepathy-glib/svc-interface-skeleton.c index 246baac51..9a2a92074 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 */ |