From d87ffd3403e55087ee99a2c237d909503494dd6c Mon Sep 17 00:00:00 2001 From: infirit Date: Sun, 23 Nov 2014 09:10:22 +0100 Subject: applet: Disconnect show and deactivate menu signals before destroying the applet menu Fixes crash while removing the menu bar or a drawer. Based on gnome-panel commit: 8211f19c2c331b1502694a03e1b5abfdc793b56b From: Carlos Garcia Campos --- mate-panel/applet.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mate-panel/applet.c b/mate-panel/applet.c index fa668e89..201459e7 100644 --- a/mate-panel/applet.c +++ b/mate-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 * mate_panel_applet_get_panel_widget (AppletInfo *info) @@ -166,6 +168,9 @@ mate_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 = mate_panel_applet_create_menu (info); } @@ -784,8 +789,11 @@ mate_panel_applet_destroy (GtkWidget *widget, panel_lockdown_notify_remove (G_CALLBACK (mate_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) -- cgit v1.2.1