[empathy] individual-menu: ensure that the contact stays alive while the activate signal is connected (#641119



commit 8978c0d955186405e291a7ff2ac71a063cdb9e68
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Feb 3 11:02:35 2011 +0100

    individual-menu: ensure that the contact stays alive while the activate signal is connected (#641119)

 libempathy-gtk/empathy-individual-menu.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c
index 29ead4f..76d7081 100644
--- a/libempathy-gtk/empathy-individual-menu.c
+++ b/libempathy-gtk/empathy-individual-menu.c
@@ -460,8 +460,10 @@ menu_item_set_contact (GtkWidget *item,
 
   if (can_do_action == TRUE)
     {
-      g_signal_connect (item, "activate", G_CALLBACK (activate_callback),
-          contact);
+      /* We want to make sure that the EmpathyContact stays alive while the
+       * signal is connected. */
+      g_signal_connect_data (item, "activate", G_CALLBACK (activate_callback),
+          g_object_ref (contact), (GClosureNotify) g_object_unref, 0);
     }
 
   return can_do_action;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]