[gnome-panel/gtk3] applet: Disconnect show and deactivate menu signals before destroying the applet menu



commit 8211f19c2c331b1502694a03e1b5abfdc793b56b
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sat Jan 22 14:05:37 2011 +0100

    applet: Disconnect show and deactivate menu signals before destroying the applet menu
    
    Fixes crash while removing the menu bar or a drawer.
    https://bugzilla.gnome.org/show_bug.cgi?id=639029

 gnome-panel/applet.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gnome-panel/applet.c b/gnome-panel/applet.c
index 805160c..7db4dae 100644
--- a/gnome-panel/applet.c
+++ b/gnome-panel/applet.c
@@ -41,6 +41,8 @@ static GSList *registered_applets = NULL;
 static GSList *queued_position_saves = NULL;
 static guint   queued_position_source = 0;
 
+static void applet_menu_show       (GtkWidget *w, AppletInfo *info);
+static void applet_menu_deactivate (GtkWidget *w, AppletInfo *info);
 
 static inline PanelWidget *
 panel_applet_get_panel_widget (AppletInfo *info)
@@ -166,6 +168,9 @@ panel_applet_recreate_menu (AppletInfo	*info)
 		menu->submenu =NULL;
 	}
 
+        g_signal_handlers_disconnect_by_func (info->menu, G_CALLBACK (applet_menu_show), info);
+        g_signal_handlers_disconnect_by_func (info->menu, G_CALLBACK (applet_menu_deactivate), info);
+
 	g_object_unref (info->menu);
 	info->menu = panel_applet_create_menu (info);
 }
@@ -773,8 +778,11 @@ panel_applet_destroy (GtkWidget  *widget,
 		panel_lockdown_notify_remove (G_CALLBACK (panel_applet_recreate_menu),
 					      info);
 
-	if (info->menu)
+	if (info->menu) {
+                g_signal_handlers_disconnect_by_func (info->menu, G_CALLBACK (applet_menu_show), info);
+                g_signal_handlers_disconnect_by_func (info->menu, G_CALLBACK (applet_menu_deactivate), info);
 		g_object_unref (info->menu);
+        }
 	info->menu = NULL;
 
 	if (info->data_destroy)



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