diff options
author | Debarshi Ray <debarshir@src.gnome.org> | 2012-06-08 01:33:05 +0800 |
---|---|---|
committer | Debarshi Ray <debarshir@src.gnome.org> | 2012-06-11 19:03:03 +0800 |
commit | 6446a3804c4d39c6be79da91ee116dfab536f23e (patch) | |
tree | c130f8780328ec5fd6ad4a3532e3762cf256cb9e | |
parent | 5ab3e5d5d54b8212a5edb7d2e72889a01cdd122b (diff) | |
download | gsoc2013-empathy-6446a3804c4d39c6be79da91ee116dfab536f23e.tar gsoc2013-empathy-6446a3804c4d39c6be79da91ee116dfab536f23e.tar.gz gsoc2013-empathy-6446a3804c4d39c6be79da91ee116dfab536f23e.tar.bz2 gsoc2013-empathy-6446a3804c4d39c6be79da91ee116dfab536f23e.tar.lz gsoc2013-empathy-6446a3804c4d39c6be79da91ee116dfab536f23e.tar.xz gsoc2013-empathy-6446a3804c4d39c6be79da91ee116dfab536f23e.tar.zst gsoc2013-empathy-6446a3804c4d39c6be79da91ee116dfab536f23e.zip |
empathy-chat: abort got_filtered_messages_cb if object was destroyed
Fixes: https://bugzilla.gnome.org/677641
-rw-r--r-- | 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 18b08d480..e6fd4538a 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); } |