[empathy] empathy-chat: abort got_filtered_messages_cb if object was destroyed
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] empathy-chat: abort got_filtered_messages_cb if object was destroyed
- Date: Mon, 11 Jun 2012 11:19:39 +0000 (UTC)
commit 6446a3804c4d39c6be79da91ee116dfab536f23e
Author: Debarshi Ray <debarshir src gnome org>
Date: Thu Jun 7 19:33:05 2012 +0200
empathy-chat: abort got_filtered_messages_cb if object was destroyed
Fixes: https://bugzilla.gnome.org/677641
libempathy-gtk/empathy-chat.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 18b08d4..e6fd453 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -2548,10 +2548,18 @@ got_filtered_messages_cb (GObject *manager,
{
GList *l;
GList *messages;
- EmpathyChat *chat = EMPATHY_CHAT (user_data);
- EmpathyChatPriv *priv = GET_PRIV (chat);
+ TpWeakRef *wr = user_data;
+ EmpathyChat *chat = tp_weak_ref_dup_object (wr);
+ EmpathyChatPriv *priv;
GError *error = NULL;
+ if (chat == NULL) {
+ tp_weak_ref_destroy (wr);
+ return;
+ }
+
+ priv = GET_PRIV (chat);
+
if (!tpl_log_manager_get_filtered_events_finish (TPL_LOG_MANAGER (manager),
result, &messages, &error)) {
DEBUG ("%s. Aborting.", error->message);
@@ -2613,6 +2621,9 @@ out:
/* Turn back on scrolling */
empathy_chat_view_scroll (chat->view, TRUE);
+
+ g_object_unref (chat);
+ tp_weak_ref_destroy (wr);
}
static void
@@ -2643,7 +2654,7 @@ chat_add_logs (EmpathyChat *chat)
chat_log_filter,
chat,
got_filtered_messages_cb,
- (gpointer) chat);
+ tp_weak_ref_new (chat, NULL, NULL));
g_object_unref (target);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]