From 6e45610823964f6a6dfec175daf844767ce91105 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Mon, 12 Nov 2001 17:51:23 +0000 Subject: Release callback's reference to EContactListEditor. (list_modified_cb): 2001-11-12 Jon Trowbridge * gui/contact-list-editor/e-contact-list-editor.c (list_added_cb): Release callback's reference to EContactListEditor. (list_modified_cb): Release callback's reference to EContactListEditor. (save_card): Ref the EContactListEditor on behalf of the e_book_foo callback. (Fixes bug #14743) (save_card): Set changed to false once we've saved. (list_deleted_cb): Release callback's reference. (delete_cb): Hold reference for the callback. svn path=/trunk/; revision=14673 --- addressbook/ChangeLog | 12 +++++++++ .../contact-list-editor/e-contact-list-editor.c | 30 +++++++++++++++------- 2 files changed, 33 insertions(+), 9 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 18802fdb07..b5c9a6e9f4 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,15 @@ +2001-11-12 Jon Trowbridge + + * gui/contact-list-editor/e-contact-list-editor.c (list_added_cb): + Release callback's reference to EContactListEditor. + (list_modified_cb): Release callback's reference to + EContactListEditor. + (save_card): Ref the EContactListEditor on behalf of the + e_book_foo callback. (Fixes bug #14743) + (save_card): Set changed to false once we've saved. + (list_deleted_cb): Release callback's reference. + (delete_cb): Hold reference for the callback. + 2001-11-12 Jon Trowbridge * gui/contact-editor/e-contact-editor.c (categories_clicked): If diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c index bb223f2f18..2bc4a5749e 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -309,9 +309,8 @@ list_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruc EContactListEditor *cle = ecs->cle; gboolean should_close = ecs->should_close; - g_free (ecs); - - gtk_widget_set_sensitive (cle->app, TRUE); + if (cle->app) + gtk_widget_set_sensitive (cle->app, TRUE); cle->in_async_call = FALSE; e_card_set_id (cle->card, id); @@ -327,6 +326,9 @@ list_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruc else command_state_changed (cle); } + + gtk_object_unref (GTK_OBJECT (cle)); + g_free (ecs); } static void @@ -335,9 +337,8 @@ list_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs) EContactListEditor *cle = ecs->cle; gboolean should_close = ecs->should_close; - g_free (ecs); - - gtk_widget_set_sensitive (cle->app, TRUE); + if (cle->app) + gtk_widget_set_sensitive (cle->app, TRUE); cle->in_async_call = FALSE; gtk_signal_emit (GTK_OBJECT (cle), contact_list_editor_signals[LIST_MODIFIED], @@ -347,6 +348,9 @@ list_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs) if (should_close) close_dialog (cle); } + + gtk_object_unref (GTK_OBJECT (cle)); /* release ref held for ebook callback */ + g_free (ecs); } static void @@ -358,15 +362,19 @@ save_card (EContactListEditor *cle, gboolean should_close) EditorCloseStruct *ecs = g_new(EditorCloseStruct, 1); ecs->cle = cle; + gtk_object_ref (GTK_OBJECT (cle)); ecs->should_close = should_close; - gtk_widget_set_sensitive (cle->app, FALSE); + if (cle->app) + gtk_widget_set_sensitive (cle->app, FALSE); cle->in_async_call = TRUE; if (cle->is_new_list) e_book_add_card (cle->book, cle->card, GTK_SIGNAL_FUNC(list_added_cb), ecs); else e_book_commit_card (cle->book, cle->card, GTK_SIGNAL_FUNC(list_modified_cb), ecs); + + cle->changed = FALSE; } } @@ -417,7 +425,8 @@ tb_save_and_close_cb (GtkWidget *widget, gpointer data) static void list_deleted_cb (EBook *book, EBookStatus status, EContactListEditor *cle) { - gtk_widget_set_sensitive (cle->app, TRUE); + if (cle->app) + gtk_widget_set_sensitive (cle->app, TRUE); cle->in_async_call = FALSE; gtk_signal_emit (GTK_OBJECT (cle), contact_list_editor_signals[LIST_DELETED], @@ -426,6 +435,8 @@ list_deleted_cb (EBook *book, EBookStatus status, EContactListEditor *cle) /* always close the dialog after we successfully delete a list */ if (status == E_BOOK_STATUS_SUCCESS) close_dialog (cle); + + gtk_object_unref (GTK_OBJECT (cle)); /* release reference held for callback */ } static void @@ -443,7 +454,8 @@ delete_cb (GtkWidget *widget, gpointer data) if (!cle->is_new_list) { gtk_widget_set_sensitive (cle->app, FALSE); cle->in_async_call = TRUE; - + + gtk_object_ref (GTK_OBJECT (cle)); /* hold reference for callback */ e_book_remove_card (cle->book, card, GTK_SIGNAL_FUNC(list_deleted_cb), cle); } } -- cgit v1.2.3