From 1761fff007b20c765181f7e89c1cb4fd84c699e3 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Sat, 14 Jun 2003 04:34:20 +0000 Subject: Fix lots of leaks, update for correct use of g_object_get. Some misc 2003-06-13 Larry Ewing * gui/component/addressbook.c: * gui/component/e-cardlist-model.c: * gui/component/select-names/e-select-names-text-model.c: * gui/contact-editor/e-contact-editor.c: * gui/contact-editor/e-contact-save-as.c: * gui/contact-list-editor/e-contact-list-editor.c: * gui/widgets/e-addressbook-table-adapter.c: * gui/widgets/e-addressbook-util.c: * gui/widgets/e-addressbook-view.c: * gui/widgets/e-minicard-view.c: * gui/widgets/e-minicard.c: Fix lots of leaks, update for correct use of g_object_get. Some misc cleanups. svn path=/trunk/; revision=21442 --- addressbook/gui/component/addressbook.c | 8 +++++++- addressbook/gui/component/e-cardlist-model.c | 6 +----- .../gui/component/select-names/e-select-names-text-model.c | 7 +++++-- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'addressbook/gui/component') diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index c770aaa8f5..b21c70a83d 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -1047,7 +1047,7 @@ compare_subitems (const void *a, const void *b) static void make_suboptions (AddressbookView *view) { - ESearchBarSubitem *subitems; + ESearchBarSubitem *subitems, *s; ECategoriesMasterList *master_list; gint i, N; @@ -1072,6 +1072,12 @@ make_suboptions (AddressbookView *view) qsort (subitems + 1, N, sizeof (subitems[0]), compare_subitems); e_search_bar_set_suboption (view->search, ESB_CATEGORY, subitems); + + for (s = subitems; s->id != -1; s++) { + if (s->text) + g_free (s->text); + } + g_free (subitems); } static void diff --git a/addressbook/gui/component/e-cardlist-model.c b/addressbook/gui/component/e-cardlist-model.c index 5635d25f86..aca0bac22f 100644 --- a/addressbook/gui/component/e-cardlist-model.c +++ b/addressbook/gui/component/e-cardlist-model.c @@ -63,16 +63,13 @@ static void e_cardlist_model_set_value_at (ETableModel *etc, int col, int row, const void *val) { ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc); - ECard *card; + if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= e_cardlist_model->data_count ) return; e_table_model_pre_change(etc); e_card_simple_set(e_cardlist_model->data[row], col + 1, val); - g_object_get(e_cardlist_model->data[row], - "card", &card, - NULL); e_table_model_cell_changed(etc, col, row); } @@ -192,7 +189,6 @@ e_cardlist_model_get(ECardlistModel *model, g_object_get(model->data[row], "card", &card, NULL); - g_object_ref(card); return card; } return NULL; 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 c2ddfcf96c..7859d5b056 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 @@ -334,14 +334,17 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model); ESelectNamesModel *source = text_model->source; const char *t; + gchar *tmp; if (out) { - gchar *tmp = g_strndup (text, length); + tmp = g_strndup (text, length); fprintf (out, ">> insert \"%s\" (len=%d) at %d\n", tmp, length, pos); g_free (tmp); } - pos = CLAMP (pos, 0, g_utf8_strlen (e_select_names_model_get_textification (source, text_model->sep), -1)); + tmp = e_select_names_model_get_textification (source, text_model->sep); + pos = CLAMP (pos, 0, g_utf8_strlen (tmp, -1)); + g_free (tmp); /* We want to control all cursor motions ourselves, rather than taking hints from the ESelectNamesModel. */ -- cgit v1.2.3