From 6d45ed28597a85c6b5dfa49aeeaf3911da76cf77 Mon Sep 17 00:00:00 2001 From: Hans Petter Jansson Date: Thu, 14 Aug 2003 07:18:18 +0000 Subject: Chain. 2003-08-12 Hans Petter Jansson * backend/ebook/e-destination.c (e_destination_dispose): Chain. * gui/component/e-address-widget.c (e_address_widget_destroy): Chain. Prevent double frees. Prevent double GSource removal. * gui/component/e-cardlist-model.c (e_cardlist_model_class_init): Store parent class. (e_cardlist_model_dispose): Chain. Prevent double frees and unrefs. * gui/contact-editor/e-contact-editor-address.c (e_contact_editor_address_dispose): Chain. * gui/contact-editor/e-contact-editor-fullname.c (e_contact_editor_fullname_dispose): Chain. * gui/contact-list-editor/e-contact-list-editor.c (e_contact_list_editor_dispose): Chain. * gui/contact-list-editor/e-contact-list-model.c (contact_list_model_destroy): Chain. Prevent double frees and unrefs. * gui/widgets/e-addressbook-reflow-adapter.c (addressbook_dispose): Chain. (addressbook_finalize): Chain. * gui/widgets/e-addressbook-table-adapter.c (addressbook_dispose): Chain. * gui/widgets/e-addressbook-treeview-adapter.c (addressbook_destroy): Chain. Prevent double free. * gui/widgets/gal-view-minicard.c (gal_view_minicard_dispose): Chain. Prevent double free and detach. * gui/widgts/gal-view-treeview.c (gal_view_treeview_dispose): Chain. Prevent double free and detach. * printins/e-contact-print-style-editor.c (e_contact_print_stule_editor_destroy): Chain. Prevent double unref. svn path=/trunk/; revision=22229 --- addressbook/ChangeLog | 42 ++++++++++++++++++++++ addressbook/backend/ebook/e-destination.c | 3 ++ addressbook/gui/component/e-address-widget.c | 13 +++++-- addressbook/gui/component/e-cardlist-model.c | 16 +++++++-- .../gui/contact-editor/e-contact-editor-address.c | 3 ++ .../gui/contact-editor/e-contact-editor-fullname.c | 3 ++ .../contact-list-editor/e-contact-list-editor.c | 3 +- .../gui/contact-list-editor/e-contact-list-model.c | 11 ++++-- .../gui/widgets/e-addressbook-reflow-adapter.c | 6 ++++ .../gui/widgets/e-addressbook-table-adapter.c | 3 ++ .../gui/widgets/e-addressbook-treeview-adapter.c | 3 ++ addressbook/gui/widgets/gal-view-minicard.c | 11 ++++-- addressbook/gui/widgets/gal-view-treeview.c | 11 ++++-- .../printing/e-contact-print-style-editor.c | 8 ++++- 14 files changed, 122 insertions(+), 14 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index efc716220e..29616ad745 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,45 @@ +2003-08-12 Hans Petter Jansson + + * backend/ebook/e-destination.c (e_destination_dispose): Chain. + + * gui/component/e-address-widget.c (e_address_widget_destroy): Chain. + Prevent double frees. Prevent double GSource removal. + + * gui/component/e-cardlist-model.c (e_cardlist_model_class_init): + Store parent class. + (e_cardlist_model_dispose): Chain. Prevent double frees and unrefs. + + * gui/contact-editor/e-contact-editor-address.c + (e_contact_editor_address_dispose): Chain. + + * gui/contact-editor/e-contact-editor-fullname.c + (e_contact_editor_fullname_dispose): Chain. + + * gui/contact-list-editor/e-contact-list-editor.c + (e_contact_list_editor_dispose): Chain. + + * gui/contact-list-editor/e-contact-list-model.c + (contact_list_model_destroy): Chain. Prevent double frees and unrefs. + + * gui/widgets/e-addressbook-reflow-adapter.c (addressbook_dispose): + Chain. + (addressbook_finalize): Chain. + + * gui/widgets/e-addressbook-table-adapter.c (addressbook_dispose): + Chain. + + * gui/widgets/e-addressbook-treeview-adapter.c (addressbook_destroy): + Chain. Prevent double free. + + * gui/widgets/gal-view-minicard.c (gal_view_minicard_dispose): + Chain. Prevent double free and detach. + + * gui/widgts/gal-view-treeview.c (gal_view_treeview_dispose): + Chain. Prevent double free and detach. + + * printins/e-contact-print-style-editor.c + (e_contact_print_stule_editor_destroy): Chain. Prevent double unref. + 2003-07-23 Chris Toshok * printing/e-contact-print.c (e_contact_print_response): deal with diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c index 7ddae75b48..b147489719 100644 --- a/addressbook/backend/ebook/e-destination.c +++ b/addressbook/backend/ebook/e-destination.c @@ -110,6 +110,9 @@ e_destination_dispose (GObject *obj) g_free (dest->priv); dest->priv = NULL; } + + if (G_OBJECT_CLASS (parent_class)->dispose) + (* G_OBJECT_CLASS (parent_class)->dispose) (obj); } static void diff --git a/addressbook/gui/component/e-address-widget.c b/addressbook/gui/component/e-address-widget.c index e9698d5b1d..9ec1e6ebba 100644 --- a/addressbook/gui/component/e-address-widget.c +++ b/addressbook/gui/component/e-address-widget.c @@ -74,13 +74,22 @@ e_address_widget_destroy (GtkObject *obj) EAddressWidget *addr = E_ADDRESS_WIDGET (obj); g_free (addr->name); + addr->name = NULL; + g_free (addr->email); + addr->email = NULL; - if (addr->query_tag) + if (addr->query_tag) { e_book_simple_query_cancel (common_book, addr->query_tag); + addr->query_tag = 0; + } - if (addr->query_idle_tag) + if (addr->query_idle_tag) { g_source_remove (addr->query_idle_tag); + addr->query_idle_tag = 0; + } + + (* GTK_OBJECT_CLASS (parent_class)->destroy) (obj); } static gint diff --git a/addressbook/gui/component/e-cardlist-model.c b/addressbook/gui/component/e-cardlist-model.c index aca0bac22f..be1ff3ddd2 100644 --- a/addressbook/gui/component/e-cardlist-model.c +++ b/addressbook/gui/component/e-cardlist-model.c @@ -18,16 +18,24 @@ #define PARENT_TYPE e_table_model_get_type() +static GObjectClass *parent_class = NULL; + static void e_cardlist_model_dispose(GObject *object) { ECardlistModel *model = E_CARDLIST_MODEL(object); int i; - for ( i = 0; i < model->data_count; i++ ) { - g_object_unref(model->data[i]); + if (model->data != NULL) { + for ( i = 0; i < model->data_count; i++ ) { + g_object_unref(model->data[i]); + } + g_free(model->data); + model->data = NULL; } - g_free(model->data); + + if (G_OBJECT_CLASS (parent_class)->dispose) + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } /* This function returns the number of columns in our ETableModel. */ @@ -157,6 +165,8 @@ static void e_cardlist_model_class_init (GObjectClass *object_class) { ETableModelClass *model_class = (ETableModelClass *) object_class; + + parent_class = g_type_class_peek_parent (object_class); object_class->dispose = e_cardlist_model_dispose; diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c index f6a75bbfe5..da8bb5421f 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-address.c +++ b/addressbook/gui/contact-editor/e-contact-editor-address.c @@ -457,6 +457,9 @@ e_contact_editor_address_dispose (GObject *object) e_card_delivery_address_unref(e_contact_editor_address->address); e_contact_editor_address->address = NULL; } + + if (G_OBJECT_CLASS (parent_class)->dispose) + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } GtkWidget* diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c index 917a8fd075..4a7d6cec1b 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c +++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c @@ -145,6 +145,9 @@ e_contact_editor_fullname_dispose (GObject *object) e_card_name_unref(e_contact_editor_fullname->name); e_contact_editor_fullname->name = NULL; } + + if (G_OBJECT_CLASS (parent_class)->dispose) + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } GtkWidget* 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 e53ebf6786..39f251f5ee 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -311,7 +311,8 @@ e_contact_list_editor_init (EContactListEditor *editor) static void e_contact_list_editor_dispose (GObject *object) { - /* XXX need to call parent dispose */ + if (G_OBJECT_CLASS (parent_class)->dispose) + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } typedef struct { diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c index 6cad1bd9bf..89354aaece 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-model.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c @@ -85,13 +85,18 @@ contact_list_model_destroy (GtkObject *o) EContactListModel *model = E_CONTACT_LIST_MODEL (o); int i; - for (i = 0; i < model->data_count; i ++) { - g_object_unref (model->data[i]); + if (model->data != NULL) { + for (i = 0; i < model->data_count; i ++) { + g_object_unref (model->data[i]); + } + g_free (model->data); + model->data = NULL; } - g_free (model->data); model->data_count = 0; model->data_alloc = 0; + + (* GTK_OBJECT_CLASS (parent_class)->destroy) (o); } static void diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c index 7ece1aab8c..a4cb9364b5 100644 --- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c @@ -104,6 +104,9 @@ addressbook_dispose(GObject *object) EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object); unlink_model (adapter); + + if (G_OBJECT_CLASS (parent_class)->dispose) + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } static void @@ -112,6 +115,9 @@ addressbook_finalize(GObject *object) EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object); g_free (adapter->priv); + + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } static void diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c index b3f79f064c..6a9e06da54 100644 --- a/addressbook/gui/widgets/e-addressbook-table-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c @@ -91,6 +91,9 @@ addressbook_dispose(GObject *object) g_free (adapter->priv); adapter->priv = NULL; } + + if (G_OBJECT_CLASS (parent_class)->dispose) + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } /* This function returns the number of columns in our ETableModel. */ diff --git a/addressbook/gui/widgets/e-addressbook-treeview-adapter.c b/addressbook/gui/widgets/e-addressbook-treeview-adapter.c index af4652226e..ab1a559f0c 100644 --- a/addressbook/gui/widgets/e-addressbook-treeview-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-treeview-adapter.c @@ -89,6 +89,9 @@ addressbook_destroy(GtkObject *object) unlink_model(adapter); g_free (adapter->priv); + adapter->priv = NULL; + + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } #if 0 diff --git a/addressbook/gui/widgets/gal-view-minicard.c b/addressbook/gui/widgets/gal-view-minicard.c index 08818f9ee3..da60497cdb 100644 --- a/addressbook/gui/widgets/gal-view-minicard.c +++ b/addressbook/gui/widgets/gal-view-minicard.c @@ -89,8 +89,15 @@ static void gal_view_minicard_dispose (GObject *object) { GalViewMinicard *view = GAL_VIEW_MINICARD(object); - gal_view_minicard_detach (view); - g_free(view->title); + + if (view->title != NULL) { + gal_view_minicard_detach (view); + g_free(view->title); + view->title = NULL; + } + + if (G_OBJECT_CLASS (gal_view_minicard_parent_class)->dispose) + (* G_OBJECT_CLASS (gal_view_minicard_parent_class)->dispose) (object); } static void diff --git a/addressbook/gui/widgets/gal-view-treeview.c b/addressbook/gui/widgets/gal-view-treeview.c index f43b3add75..e18ae6341b 100644 --- a/addressbook/gui/widgets/gal-view-treeview.c +++ b/addressbook/gui/widgets/gal-view-treeview.c @@ -92,8 +92,15 @@ static void gal_view_treeview_dispose (GObject *object) { GalViewTreeView *view = GAL_VIEW_TREEVIEW(object); - gal_view_treeview_detach (view); - g_free(view->title); + + if (view->title != NULL) { + gal_view_treeview_detach (view); + g_free(view->title); + view->title = NULL; + } + + if (G_OBJECT_CLASS (gal_view_treeview_parent_class)->dispose) + (* G_OBJECT_CLASS (gal_view_treeview_parent_class)->dispose) (object); } static void diff --git a/addressbook/printing/e-contact-print-style-editor.c b/addressbook/printing/e-contact-print-style-editor.c index 9267fc0c99..436aaddff0 100644 --- a/addressbook/printing/e-contact-print-style-editor.c +++ b/addressbook/printing/e-contact-print-style-editor.c @@ -111,7 +111,13 @@ void e_contact_print_style_editor_destroy (GtkObject *object) { EContactPrintStyleEditor *e_contact_print_style_editor = E_CONTACT_PRINT_STYLE_EDITOR(object); - g_object_unref(e_contact_print_style_editor->gui); + + if (e_contact_print_style_editor->gui != NULL) { + g_object_unref(e_contact_print_style_editor->gui); + e_contact_print_style_editor->gui = NULL; + } + + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } GtkWidget* -- cgit v1.2.3