diff options
10 files changed, 171 insertions, 68 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 80c8c5717c..7fc97721e8 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,36 @@ 2002-11-08 Chris Toshok <toshok@ximian.com> + * gui/component/select-names/e-select-names-model.h: parent class + is GObjectClass. + + * gui/component/select-names/e-simple-card-bonobo.c + (impl_dispose): guard against multiple invocations, and chain + dispose. + + * gui/component/select-names/e-select-names.c + (e_select_names_dispose): guard against multiple invocations. + + * gui/component/select-names/e-select-names-text-model.c + (e_select_names_text_model_dispose): guard against multiple + invocations. + (e_select_names_text_model_set_source): fix casts. + + * gui/component/select-names/e-select-names-table-model.c + (e_select_names_table_model_add_source): remove the GTK_OBJECT + cast, fixes a warning. + (clear_info): guard against multiple invocations from ::dispose. + + * gui/component/select-names/e-select-names-manager.c + (e_select_names_manager_dispose): same. + + * gui/component/select-names/e-select-names-completion.c + (e_select_names_completion_dispose): same. + + * gui/component/select-names/e-select-names-bonobo.c + (impl_dispose): guard against multiple invocations. + +2002-11-08 Chris Toshok <toshok@ximian.com> + * gui/contact-list-editor/contact-list-editor.glade: convert to glade-2 * gui/contact-list-editor/e-contact-list-editor.c: port work. diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.c b/addressbook/gui/component/select-names/e-select-names-bonobo.c index 3d17063622..bfe182b6f2 100644 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.c +++ b/addressbook/gui/component/select-names/e-select-names-bonobo.c @@ -378,14 +378,20 @@ impl_dispose (GObject *object) select_names = E_SELECT_NAMES_BONOBO (object); priv = select_names->priv; - if (priv->manager->names) { - gtk_widget_destroy (GTK_WIDGET (priv->manager->names)); - priv->manager->names = NULL; - } + if (priv) { + if (priv->manager->names) { + gtk_widget_destroy (GTK_WIDGET (priv->manager->names)); + priv->manager->names = NULL; + } - g_object_unref (priv->manager); + g_object_unref (priv->manager); + + g_free (priv); + select_names->priv = NULL; + } - g_free (priv); + if (G_OBJECT_CLASS (parent_class)->dispose) + G_OBJECT_CLASS (parent_class)->dispose (object); } diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c index fdc5b22c37..59c91049ad 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -791,19 +791,22 @@ e_select_names_completion_dispose (GObject *object) { ESelectNamesCompletion *comp = E_SELECT_NAMES_COMPLETION (object); - if (comp->priv->text_model) - g_object_unref (comp->priv->text_model); + if (comp->priv) { + if (comp->priv->text_model) + g_object_unref (comp->priv->text_model); - e_select_names_completion_clear_book_data (comp); + e_select_names_completion_clear_book_data (comp); - g_free (comp->priv->waiting_query); - g_free (comp->priv->query_text); + g_free (comp->priv->waiting_query); + g_free (comp->priv->query_text); - g_free (comp->priv->cached_query_text); - g_list_foreach (comp->priv->cached_cards, (GFunc)g_object_unref, NULL); - g_list_free (comp->priv->cached_cards); + g_free (comp->priv->cached_query_text); + g_list_foreach (comp->priv->cached_cards, (GFunc)g_object_unref, NULL); + g_list_free (comp->priv->cached_cards); - g_free (comp->priv); + g_free (comp->priv); + comp->priv = NULL; + } if (parent_class->dispose) parent_class->dispose (object); diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c index a4d6a0c1a8..120fc25f97 100644 --- a/addressbook/gui/component/select-names/e-select-names-manager.c +++ b/addressbook/gui/component/select-names/e-select-names-manager.c @@ -38,6 +38,7 @@ enum { static guint e_select_names_manager_signals[LAST_SIGNAL] = { 0 }; +static GObjectClass *parent_class = NULL; typedef struct { char *id; @@ -60,7 +61,7 @@ typedef struct { static void e_select_names_manager_init (ESelectNamesManager *manager); static void e_select_names_manager_class_init (ESelectNamesManagerClass *klass); -static void e_select_names_manager_destroy (GtkObject *object); +static void e_select_names_manager_dispose (GObject *object); /* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ @@ -605,9 +606,9 @@ e_select_names_manager_activate_dialog (ESelectNamesManager *manager, manager); g_signal_connect(manager->names, - "destroy", - G_CALLBACK(gtk_widget_destroyed), - &manager->names); + "destroy", + G_CALLBACK(gtk_widget_destroyed), + &manager->names); gtk_widget_show(GTK_WIDGET(manager->names)); } @@ -638,21 +639,36 @@ e_select_names_manager_dispose (GObject *object) manager->names = NULL; } - g_list_foreach (manager->sections, (GFunc) e_select_names_manager_section_free, NULL); - g_list_free (manager->sections); - manager->sections = NULL; + if (manager->sections) { + g_list_foreach (manager->sections, (GFunc) e_select_names_manager_section_free, NULL); + g_list_free (manager->sections); + manager->sections = NULL; + } + + if (manager->entries) { + g_list_foreach (manager->entries, (GFunc) e_select_names_manager_entry_free, NULL); + g_list_free (manager->entries); + manager->entries = NULL; + } - g_list_foreach (manager->entries, (GFunc) e_select_names_manager_entry_free, NULL); - g_list_free (manager->entries); - manager->entries = NULL; + if (manager->completion_books) { + g_list_foreach (manager->completion_books, (GFunc) g_object_unref, NULL); + g_list_free (manager->completion_books); + manager->completion_books = NULL; + } - g_list_foreach (manager->completion_books, (GFunc) g_object_unref, NULL); - g_list_free (manager->completion_books); - manager->completion_books = NULL; + if (manager->listener_id) { + g_signal_handler_disconnect (e_book_get_config_database(), manager->listener_id); + manager->listener_id = 0; + } - g_signal_handler_disconnect (e_book_get_config_database(), manager->listener_id); + if (manager->cached_folder_list) { + g_free (manager->cached_folder_list); + manager->cached_folder_list = NULL; + } - g_free (manager->cached_folder_list); + if (G_OBJECT_CLASS (parent_class)->dispose) + G_OBJECT_CLASS (parent_class)->dispose (object); } static void @@ -661,6 +677,7 @@ e_select_names_manager_class_init (ESelectNamesManagerClass *klass) GObjectClass *object_class; object_class = G_OBJECT_CLASS(klass); + parent_class = g_type_class_peek_parent (klass); object_class->dispose = e_select_names_manager_dispose; diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c index 6c31e1baf7..65ae293174 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -61,6 +61,7 @@ struct _ESelectNamesModelPrivate { gboolean pending_changed; }; +static GObjectClass *parent_class = NULL; static void e_select_names_model_init (ESelectNamesModel *model); static void e_select_names_model_class_init (ESelectNamesModelClass *klass); @@ -97,6 +98,7 @@ e_select_names_model_class_init (ESelectNamesModelClass *klass) GObjectClass *object_class; object_class = G_OBJECT_CLASS(klass); + parent_class = g_type_class_peek_parent (klass); e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED] = g_signal_new ("changed", @@ -139,15 +141,20 @@ static void e_select_names_model_dispose (GObject *object) { ESelectNamesModel *model = E_SELECT_NAMES_MODEL (object); - - g_free (model->priv->title); - g_free (model->priv->id); - g_list_foreach (model->priv->data, (GFunc) g_object_unref, NULL); - g_list_free (model->priv->data); + if (model->priv) { + g_free (model->priv->title); + g_free (model->priv->id); - g_free (model->priv); + g_list_foreach (model->priv->data, (GFunc) g_object_unref, NULL); + g_list_free (model->priv->data); + + g_free (model->priv); + model->priv = NULL; + } + if (G_OBJECT_CLASS (parent_class)->dispose) + G_OBJECT_CLASS (parent_class)->dispose (object); } diff --git a/addressbook/gui/component/select-names/e-select-names-model.h b/addressbook/gui/component/select-names/e-select-names-model.h index 40989ff370..8a3c5381b7 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.h +++ b/addressbook/gui/component/select-names/e-select-names-model.h @@ -29,13 +29,13 @@ typedef struct _ESelectNamesModelClass ESelectNamesModelClass; struct _ESelectNamesModelPrivate; struct _ESelectNamesModel { - GtkObject object; + GObject object; struct _ESelectNamesModelPrivate *priv; }; struct _ESelectNamesModelClass { - GtkObjectClass parent_class; + GObjectClass parent_class; void (*changed) (ESelectNamesModel *model); void (*resized) (ESelectNamesModel *model, gint index, gint old_len, gint new_len); diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.c b/addressbook/gui/component/select-names/e-select-names-table-model.c index 476d009844..04c6a80f88 100644 --- a/addressbook/gui/component/select-names/e-select-names-table-model.c +++ b/addressbook/gui/component/select-names/e-select-names-table-model.c @@ -27,12 +27,13 @@ enum { static void e_select_names_table_model_init (ESelectNamesTableModel *model); static void e_select_names_table_model_class_init (ESelectNamesTableModelClass *klass); -static void e_select_names_table_model_destroy (GtkObject *object); +static void e_select_names_table_model_dispose (GObject *object); static void e_select_names_table_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void e_select_names_table_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void e_select_names_table_model_model_changed (ESelectNamesModel *source, ESelectNamesTableModel *model); +static ETableModelClass *parent_class = NULL; static void e_select_names_table_model_add_source (ESelectNamesTableModel *model, @@ -41,9 +42,9 @@ e_select_names_table_model_add_source (ESelectNamesTableModel *model, model->source = source; if (model->source) g_object_ref(model->source); - model->source_changed_id = g_signal_connect(GTK_OBJECT(model->source), "changed", - G_CALLBACK(e_select_names_table_model_model_changed), - model); + model->source_changed_id = g_signal_connect(model->source, "changed", + G_CALLBACK(e_select_names_table_model_model_changed), + model); } static void @@ -145,14 +146,16 @@ fill_in_info (ESelectNamesTableModel *model) static void clear_info (ESelectNamesTableModel *model) { - int i; - for (i = 0; i < model->count; i++) { - g_free(model->data[i].name); - g_free(model->data[i].email); + if (model->data) { + int i; + for (i = 0; i < model->count; i++) { + g_free(model->data[i].name); + g_free(model->data[i].email); + } + g_free(model->data); + model->data = NULL; + model->count = -1; } - g_free(model->data); - model->data = NULL; - model->count = -1; } /* @@ -168,6 +171,9 @@ e_select_names_table_model_dispose (GObject *object) e_select_names_table_model_drop_source (model); clear_info(model); + + if (G_OBJECT_CLASS (parent_class)->dispose) + G_OBJECT_CLASS (parent_class)->dispose (object); } /* This function returns the number of columns in our ETableModel. */ @@ -332,6 +338,8 @@ e_select_names_table_model_class_init (ESelectNamesTableModelClass *klass) object_class = G_OBJECT_CLASS(klass); table_model_class = E_TABLE_MODEL_CLASS(klass); + parent_class = g_type_class_peek_parent (klass); + object_class->dispose = e_select_names_table_model_dispose; object_class->get_property = e_select_names_table_model_get_property; object_class->set_property = e_select_names_table_model_set_property; diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.c b/addressbook/gui/component/select-names/e-select-names-text-model.c index 2463e4c1f2..48a1601770 100644 --- a/addressbook/gui/component/select-names/e-select-names-text-model.c +++ b/addressbook/gui/component/select-names/e-select-names-text-model.c @@ -163,8 +163,14 @@ e_select_names_text_model_dispose (GObject *object) model = E_SELECT_NAMES_TEXT_MODEL (object); - g_free (model->text); - g_free (model->sep); + if (model->text) { + g_free (model->text); + model->text = NULL; + } + if (model->sep) { + g_free (model->sep); + model->sep = NULL; + } e_select_names_text_model_set_source (model, NULL); @@ -264,13 +270,13 @@ e_select_names_text_model_set_source (ESelectNamesTextModel *model, if (model->source) { g_object_ref (model->source); - model->source_changed_id = g_signal_connect (GTK_OBJECT(model->source), + model->source_changed_id = g_signal_connect (model->source, "changed", - GTK_SIGNAL_FUNC (changed_cb), + G_CALLBACK (changed_cb), model); - model->source_resize_id = g_signal_connect (GTK_OBJECT(model->source), + model->source_resize_id = g_signal_connect (model->source, "resized", - GTK_SIGNAL_FUNC (resize_cb), + G_CALLBACK (resize_cb), model); } } diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index aa11db902a..162343675d 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -592,16 +592,37 @@ e_select_names_dispose (GObject *object) { ESelectNames *e_select_names = E_SELECT_NAMES(object); - g_object_unref(e_select_names->gui); - g_hash_table_foreach(e_select_names->children, (GHFunc) e_select_names_child_free, e_select_names); - g_hash_table_destroy(e_select_names->children); - g_object_unref(e_select_names->without); - g_object_unref(e_select_names->adapter); - g_object_unref(e_select_names->model); + if (e_select_names->gui) { + g_object_unref(e_select_names->gui); + e_select_names->gui = NULL; + } - g_free(e_select_names->def); + if (e_select_names->children) { + g_hash_table_foreach(e_select_names->children, (GHFunc) e_select_names_child_free, e_select_names); + g_hash_table_destroy(e_select_names->children); + e_select_names->children = NULL; + } + + if (e_select_names->without) { + g_object_unref(e_select_names->without); + e_select_names->without = NULL; + } + if (e_select_names->adapter) { + g_object_unref(e_select_names->adapter); + e_select_names->adapter = NULL; + } + if (e_select_names->model) { + g_object_unref(e_select_names->model); + e_select_names->model = NULL; + } + + if (e_select_names->def) { + g_free(e_select_names->def); + e_select_names->def = NULL; + } - (*(G_OBJECT_CLASS(parent_class))->dispose)(object); + if (G_OBJECT_CLASS(parent_class)->dispose) + G_OBJECT_CLASS(parent_class)->dispose(object); } GtkWidget* diff --git a/addressbook/gui/component/select-names/e-simple-card-bonobo.c b/addressbook/gui/component/select-names/e-simple-card-bonobo.c index f61c6d1866..0577daa648 100644 --- a/addressbook/gui/component/select-names/e-simple-card-bonobo.c +++ b/addressbook/gui/component/select-names/e-simple-card-bonobo.c @@ -140,13 +140,17 @@ impl_dispose (GObject *object) simple_card = E_SIMPLE_CARD_BONOBO (object); priv = simple_card->priv; - if (priv->card_simple) { - g_object_unref (priv->card_simple); - } + if (priv) { + if (priv->card_simple) { + g_object_unref (priv->card_simple); + } - g_free (priv); + g_free (priv); + simple_card->priv = NULL; + } - simple_card->priv = NULL; + if (G_OBJECT_CLASS(parent_class)->dispose) + G_OBJECT_CLASS(parent_class)->dispose(object); } |