summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-11 13:04:18 +0100
committerXavier Claessens <xavier.claessens@collabora.com>2014-04-14 14:30:27 -0400
commit1fa13d052817edeb4ea03192a613dab4f2b2a56a (patch)
treee78962f22d3c6f26c90b030e4dbe9dcab10ceb49
parent89d8011a8441d36d69d5131975b9c9eedb39373a (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.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 */