From 091742c6d6750bed7f8c5749e2f06f5bf6c51896 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 25 Apr 2012 16:39:21 +0200 Subject: [PATCH] tp_am_set_default(): Take a weak ref instead of a strong one https://bugs.freedesktop.org/show_bug.cgi?id=48230 --- telepathy-glib/account-manager.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c index ec4d52d..c67f219 100644 --- a/telepathy-glib/account-manager.c +++ b/telepathy-glib/account-manager.c @@ -785,8 +785,12 @@ static gpointer starter_account_manager_proxy = NULL; * #TpAccountManager to use that factory should call this after calling * tp_account_manager_new_with_factory(). * + * Only a weak reference is taken on @manager, it is caller's responsability to + * keep it alive. Otherwise next call to tp_account_manager_dup() will return + * a newly created #TpAccountManager. + * * Note that @manager must use the default #TpDBusDaemon as returned by - * tp_dbus_daemon_dup() + * tp_dbus_daemon_dup(). * * Since: 0.15.5 */ @@ -809,7 +813,9 @@ tp_account_manager_set_default (TpAccountManager *manager) g_return_if_reached (); } - starter_account_manager_proxy = g_object_ref (manager); + starter_account_manager_proxy = manager; + g_object_add_weak_pointer (starter_account_manager_proxy, + &starter_account_manager_proxy); } /** -- 1.7.9.5