[Telepathy-commits] [telepathy-glib/master] TpConnectionManager: ref the TpCM while NameOwnerChanged is processed
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu Feb 12 10:34:25 PST 2009
Previously, tp_connection_manager_end_introspection could sometimes
result in losing the last reference, and a crash.
---
telepathy-glib/connection-manager.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c
index b36501f..3adceea 100644
--- a/telepathy-glib/connection-manager.c
+++ b/telepathy-glib/connection-manager.c
@@ -614,6 +614,9 @@ tp_connection_manager_name_owner_changed_cb (TpDBusDaemon *bus,
{
TpConnectionManager *self = user_data;
+ /* make sure self exists for the duration of this callback */
+ g_object_ref (self);
+
if (new_owner[0] == '\0')
{
GError e = { TP_DBUS_ERRORS, TP_DBUS_ERROR_NAME_OWNER_LOST,
@@ -640,6 +643,8 @@ tp_connection_manager_name_owner_changed_cb (TpDBusDaemon *bus,
self->priv->introspect_idle_id = g_idle_add (
tp_connection_manager_idle_introspect, self);
}
+
+ g_object_unref (self);
}
static gboolean
--
1.5.6.5
More information about the telepathy-commits
mailing list