Mercurial > pidgin-twitter
changeset 79:a4a6c7b204c9
fixed changeset 78:0b93dd0e0de1: fixed removing the mark
author | mikanbako <maoutwo@gmail.com> |
---|---|
date | Mon, 30 Jun 2008 11:02:01 +0900 |
parents | 0b93dd0e0de1 |
children | e0bf37c105eb |
files | pidgin-twitter.c |
diffstat | 1 files changed, 20 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin-twitter.c Sun Jun 29 23:48:28 2008 +0900 +++ b/pidgin-twitter.c Mon Jun 30 11:02:01 2008 +0900 @@ -727,7 +727,9 @@ current = next; } - g_hash_table_insert(icon_mark_list_by_user, user_name, mark_list); + /* Does not replace the old key */ + g_hash_table_insert(icon_mark_list_by_user, + g_strdup(user_name), mark_list); } g_list_free(user_name_list); } @@ -1273,11 +1275,23 @@ list = g_hash_table_get_values(icon_mark_list_by_user); for(current = g_list_first(list); current; current = g_list_next(current)) { - /* Free a list of marks. - * Do not free the marks here - * because the marks are owned by GtkTextBuffers. - */ - g_list_free(current->data); + GList *mark_list = current->data; + GList *current_mark_list; + + /* remove the marks in its GtkTextBuffers */ + for(current_mark_list = g_list_first(mark_list); current_mark_list; + current_mark_list = g_list_next(current_mark_list)) { + GtkTextMark *current_mark = current_mark_list->data; + GtkTextBuffer *text_buffer = gtk_text_mark_get_buffer( + current_mark); + + if(text_buffer) { + /* the mark will be freed in this function */ + gtk_text_buffer_delete_mark(text_buffer, current_mark); + } + } + + g_list_free(mark_list); } g_list_free(list); g_hash_table_destroy(icon_mark_list_by_user);