diff options
Diffstat (limited to 'widgets/misc')
-rw-r--r-- | widgets/misc/e-attachment-button.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/widgets/misc/e-attachment-button.c b/widgets/misc/e-attachment-button.c index dac9b28c75..d1b02c09f3 100644 --- a/widgets/misc/e-attachment-button.c +++ b/widgets/misc/e-attachment-button.c @@ -41,6 +41,7 @@ struct _EAttachmentButtonPrivate { GtkWidget *expand_button; GtkWidget *toggle_button; GtkWidget *cell_view; + GtkWidget *popup_menu; guint expandable : 1; guint expanded : 1; @@ -278,17 +279,21 @@ static void attachment_button_set_view (EAttachmentButton *button, EAttachmentView *view) { - GtkWidget *menu; + GtkWidget *popup_menu; g_return_if_fail (button->priv->view == NULL); button->priv->view = g_object_ref (view); - menu = e_attachment_view_get_popup_menu (view); + popup_menu = e_attachment_view_get_popup_menu (view); g_signal_connect_swapped ( - menu, "deactivate", + popup_menu, "deactivate", G_CALLBACK (attachment_button_menu_deactivate_cb), button); + + /* Keep a reference to the popup menu so we can + * disconnect the signal handler in dispose(). */ + button->priv->popup_menu = g_object_ref (popup_menu); } static void @@ -400,6 +405,14 @@ attachment_button_dispose (GObject *object) priv->cell_view = NULL; } + if (priv->popup_menu != NULL) { + g_signal_handlers_disconnect_matched ( + priv->popup_menu, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, object); + g_object_unref (priv->popup_menu); + priv->popup_menu = NULL; + } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (parent_class)->dispose (object); } |