From 3b2bc2c2447068b3c1a8d31aaa90e21b2b8f79ff Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Tue, 4 Feb 2003 00:13:38 +0000 Subject: [ pull forward Jack Jia's fix for #34900 ] use a weak ref for the file 2003-02-03 Chris Toshok [ pull forward Jack Jia's fix for #34900 ] * gui/contact-editor/e-contact-save-as.c (e_contact_save_as): use a weak ref for the file selector. (e_contact_list_save_as): same. (destroy_it): rewrite this as a weak ref notify function. (close_it): remove frees of the info (it's freed in the weak ref function). (save_it): same. svn path=/trunk/; revision=19722 --- addressbook/gui/contact-editor/e-contact-save-as.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'addressbook/gui/contact-editor') diff --git a/addressbook/gui/contact-editor/e-contact-save-as.c b/addressbook/gui/contact-editor/e-contact-save-as.c index 48abe98813..2478eadeb1 100644 --- a/addressbook/gui/contact-editor/e-contact-save-as.c +++ b/addressbook/gui/contact-editor/e-contact-save-as.c @@ -76,22 +76,19 @@ save_it(GtkWidget *widget, SaveAsInfo *info) return; } - g_free (info->vcard); gtk_widget_destroy(GTK_WIDGET(info->filesel)); - g_free(info); } static void close_it(GtkWidget *widget, SaveAsInfo *info) { - g_free (info->vcard); gtk_widget_destroy (GTK_WIDGET (info->filesel)); - g_free (info); } static void -delete_it(GtkWidget *widget, SaveAsInfo *info) +destroy_it(void *data, GObject *where_the_object_was) { + SaveAsInfo *info = data; g_free (info->vcard); g_free (info); } @@ -143,8 +140,7 @@ e_contact_save_as(char *title, ECard *card, GtkWindow *parent_window) G_CALLBACK (save_it), info); g_signal_connect(filesel->cancel_button, "clicked", G_CALLBACK (close_it), info); - g_signal_connect(filesel, "delete_event", - G_CALLBACK (delete_it), info); + g_object_weak_ref (G_OBJECT (filesel), destroy_it, info); if (parent_window) { gtk_window_set_transient_for (GTK_WINDOW (filesel), @@ -186,8 +182,7 @@ e_contact_list_save_as(char *title, GList *list, GtkWindow *parent_window) G_CALLBACK (save_it), info); g_signal_connect(filesel->cancel_button, "clicked", G_CALLBACK (close_it), info); - g_signal_connect(filesel, "delete_event", - G_CALLBACK (delete_it), info); + g_object_weak_ref (G_OBJECT (filesel), destroy_it, info); if (parent_window) { gtk_window_set_transient_for (GTK_WINDOW (filesel), -- cgit v1.2.3