summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-11 13:04:18 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-11 13:04:18 +0100
commitfd1ea395b215b5704460eb615888f6dfae21f815 (patch)
tree925701db2a88b23df1665222e88afbe40edbed4a
parent9c29692980a3013cda5ba442f6c6dd14346d9f34 (diff)
tp_svc_interface_skeleton_emit_signal: ignore if no longer exportedwip-gdbus-object
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.c13
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 */