← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~bratsche/indicator-me/disconnect-some-signals into lp:indicator-me

 

Cody Russell has proposed merging lp:~bratsche/indicator-me/disconnect-some-signals into lp:indicator-me.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)
Related bugs:
  #643906 indicator-me may crash after service restart
  https://bugs.launchpad.net/bugs/643906

-- 
https://code.launchpad.net/~bratsche/indicator-me/disconnect-some-signals/+merge/36249
Your team ayatana-commits is subscribed to branch lp:indicator-me.
=== modified file 'src/indicator-me.c'
--- src/indicator-me.c	2010-09-16 14:49:20 +0000
+++ src/indicator-me.c	2010-09-22 04:15:56 +0000
@@ -90,6 +90,8 @@
 static gboolean new_entry_item (DbusmenuMenuitem * newitem,
                                 DbusmenuMenuitem * parent,
                                 DbusmenuClient   * client);
+static void     entry_activate_cb (GtkEntry *entry, DbusmenuMenuitem *mi);
+static void     entry_prop_change_cb (DbusmenuMenuitem *mi, gchar *prop, GValue *value, GtkEntry *entry);
 
 G_DEFINE_TYPE (IndicatorMe, indicator_me, INDICATOR_OBJECT_TYPE);
 
@@ -205,6 +207,25 @@
 }
 
 static void
+item_destroyed_cb (GtkObject *item,
+                   gpointer   user_data)
+{
+  g_print (" ***** item destroyed!\n");
+
+  g_signal_handlers_disconnect_by_func (user_data,
+                                        G_CALLBACK (entry_activate_cb),
+                                        item);
+
+  g_signal_handlers_disconnect_by_func (user_data,
+                                        G_CALLBACK (entry_activate_cb),
+                                        item);
+
+  g_signal_handlers_disconnect_by_func (user_data,
+                                        G_CALLBACK (entry_prop_change_cb),
+                                        item);
+}
+
+static void
 connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata)
 {
 	if (connected) {
@@ -424,10 +445,15 @@
 
   g_signal_connect (entry,
                     "grab-focus", G_CALLBACK (entry_focus_grab_cb),
-                    entry);
+                    NULL);
 
   g_signal_connect (entry,
                     "grab-broken-event", G_CALLBACK (entry_focus_ungrab_cb),
+                    NULL);
+
+  g_signal_connect (newitem,
+                    "destroy",
+                    G_CALLBACK (item_destroyed_cb),
                     entry);
 
 	return TRUE;


Follow ups