# HG changeset patch # User mikanbako # Date 1214791321 -32400 # Node ID a4a6c7b204c9bad723e16861e4675e1849528d61 # Parent 0b93dd0e0de18237dc59792c6c24fe0b9feb612f fixed changeset 78:0b93dd0e0de1: fixed removing the mark diff -r 0b93dd0e0de1 -r a4a6c7b204c9 pidgin-twitter.c --- 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);