From e5011edd94a51339ae21e2690fd90af652425549 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 6 Jan 2009 16:49:56 +0000 Subject: Create the EmpathyContactMonitor lazily if needed. svn path=/trunk/; revision=2099 --- libempathy/empathy-tp-chat.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libempathy/empathy-tp-chat.c') diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index bda30edb4..8517c1c0d 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -259,6 +259,10 @@ tp_chat_get_monitor (EmpathyContactList *list) priv = GET_PRIV (list); + if (priv->contact_monitor == NULL) { + priv->contact_monitor = empathy_contact_monitor_new_for_iface (list); + } + return priv->contact_monitor; } @@ -908,7 +912,10 @@ tp_chat_finalize (GObject *object) g_object_unref (priv->group); } - g_object_unref (priv->contact_monitor); + if (priv->contact_monitor) { + g_object_unref (priv->contact_monitor); + } + g_object_unref (priv->factory); g_object_unref (priv->user); g_object_unref (priv->account); @@ -1112,7 +1119,7 @@ empathy_tp_chat_init (EmpathyTpChat *chat) EMPATHY_TYPE_TP_CHAT, EmpathyTpChatPriv); chat->priv = priv; - priv->contact_monitor = empathy_contact_monitor_new_for_proxy (EMPATHY_CONTACT_LIST (chat)); + priv->contact_monitor = NULL; } static void -- cgit v1.2.3