From: Nathan W. <fac...@us...> - 2003-09-07 15:55:40
|
Update of /cvsroot/gaim/gaim/src In directory sc8-pr-cvs1:/tmp/cvs-serv27823/src Modified Files: blist.c gtkblist.c gtksound.c Log Message: memleak fixen Index: blist.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/blist.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -p -r1.65 -r1.66 --- blist.c 7 Sep 2003 06:55:26 -0000 1.65 +++ blist.c 7 Sep 2003 15:55:27 -0000 1.66 @@ -1735,7 +1735,6 @@ static gboolean blist_safe_to_write = FA GaimGroup *blist_parser_group = NULL; GaimContact *blist_parser_contact = NULL; -static char *blist_parser_group_name = NULL; static char *blist_parser_account_name = NULL; static int blist_parser_account_protocol = 0; static char *blist_parser_chat_alias = NULL; @@ -1783,15 +1782,15 @@ static void blist_start_element_handler } else if(!strcmp(element_name, "blist")) { tag_stack = g_list_prepend(tag_stack, GINT_TO_POINTER(BLIST_TAG_BLIST)); } else if(!strcmp(element_name, "group")) { + char *name = NULL; tag_stack = g_list_prepend(tag_stack, GINT_TO_POINTER(BLIST_TAG_GROUP)); for(i=0; attribute_names[i]; i++) { if(!strcmp(attribute_names[i], "name")) { - g_free(blist_parser_group_name); - blist_parser_group_name = g_strdup(attribute_values[i]); + name = attribute_values[i]; } } - if(blist_parser_group_name) { - blist_parser_group = gaim_group_new(blist_parser_group_name); + if(name) { + blist_parser_group = gaim_group_new(name); gaim_blist_add_group(blist_parser_group, gaim_blist_get_last_sibling(gaimbuddylist->root)); } @@ -1887,23 +1886,20 @@ static void blist_end_element_handler(GM tag_stack = g_list_delete_link(tag_stack, tag_stack); } else if(!strcmp(element_name, "group")) { if(blist_parser_group_settings) { - GaimGroup *g = gaim_find_group(blist_parser_group_name); - g_hash_table_destroy(g->settings); - g->settings = blist_parser_group_settings; + g_hash_table_destroy(blist_parser_group->settings); + blist_parser_group->settings = blist_parser_group_settings; } tag_stack = g_list_delete_link(tag_stack, tag_stack); blist_parser_group_settings = NULL; blist_parser_group = NULL; - blist_parser_group_name = NULL; } else if(!strcmp(element_name, "chat")) { GaimAccount *account = gaim_accounts_find(blist_parser_account_name, blist_parser_account_protocol); if(account) { GaimBlistChat *chat = gaim_blist_chat_new(account, blist_parser_chat_alias, blist_parser_chat_components); - GaimGroup *g = gaim_find_group(blist_parser_group_name); - gaim_blist_add_chat(chat,g, - gaim_blist_get_last_child((GaimBlistNode*)g)); + gaim_blist_add_chat(chat,blist_parser_group, + gaim_blist_get_last_child((GaimBlistNode*)blist_parser_group)); if(blist_parser_chat_settings) { g_hash_table_destroy(chat->settings); chat->settings = blist_parser_chat_settings; Index: gtkblist.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gtkblist.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -p -r1.80 -r1.81 --- gtkblist.c 7 Sep 2003 06:53:07 -0000 1.80 +++ gtkblist.c 7 Sep 2003 15:55:27 -0000 1.81 @@ -879,6 +879,8 @@ static gboolean gaim_gtk_blist_tooltip_t gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); node = g_value_get_pointer(&val); + gtk_tree_path_free(path); + if(!GAIM_BLIST_NODE_IS_CONTACT(node) && !GAIM_BLIST_NODE_IS_BUDDY(node) && !GAIM_BLIST_NODE_IS_CHAT(node)) return FALSE; @@ -932,7 +934,6 @@ static gboolean gaim_gtk_blist_tooltip_t gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y); gtk_widget_show(gtkblist->tipwindow); - gtk_tree_path_free(path); return FALSE; } @@ -2046,6 +2047,29 @@ static void insert_node(struct gaim_budd gtk_tree_store_set(gtkblist->treemodel, iter, NODE_COLUMN, node, -1); + + if(node->parent) { + GtkTreePath *expand = NULL; + struct _gaim_gtk_blist_node *gtkparentnode = node->parent->ui_data; + + if(GAIM_BLIST_NODE_IS_GROUP(node->parent)) { + char *collapsed = gaim_group_get_setting((GaimGroup*)node->parent, + "collapsed"); + if(!collapsed) + expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter); + else + g_free(collapsed); + } else if(GAIM_BLIST_NODE_IS_CONTACT(node->parent) && + gtkparentnode->contact_expanded) { + expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter); + } + if(expand) { + gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), expand, + FALSE); + gtk_tree_path_free(expand); + } + } + } static void gaim_gtk_blist_update_group(struct gaim_buddy_list *list, GaimBlistNode *node) @@ -2060,21 +2084,10 @@ static void gaim_gtk_blist_update_group( gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies") || gaim_blist_get_group_online_count(group) > 0) { char *mark, *esc; - char *collapsed; GtkTreeIter iter; insert_node(list, node, &iter); - collapsed = gaim_group_get_setting(group, "collapsed"); - if(!collapsed) { - GtkTreePath *expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); - gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), expand, - FALSE); - gtk_tree_path_free(expand); - } else { - g_free(collapsed); - } - esc = g_markup_escape_text(group->name, -1); if(gaim_prefs_get_bool("/gaim/gtk/blist/show_group_count")) { mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)", @@ -2190,7 +2203,6 @@ static void gaim_gtk_blist_update_contac if(gtknode->contact_expanded) { GdkPixbuf *status; char *mark; - GtkTreePath *expand; status = gaim_gtk_blist_get_status_icon(node, (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ? @@ -2212,12 +2224,6 @@ static void gaim_gtk_blist_update_contac g_free(mark); if(status) g_object_unref(status); - - expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); - gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), expand, - FALSE); - gtk_tree_path_free(expand); - } else { buddy_node(buddy, &iter, node); } @@ -2662,7 +2668,7 @@ static GtkTreeIter sort_method_status(Ga { GtkTreeIter more_z, iter; GaimBlistNode *n; - GtkTreePath *newpath, *expand = NULL; + GtkTreePath *newpath; GValue val = {0,}; struct _gaim_gtk_blist_node *gtknode = (struct _gaim_gtk_blist_node *)node->ui_data; @@ -2673,19 +2679,10 @@ static GtkTreeIter sort_method_status(Ga gaim_gtk_blist_hide_node(blist, node); if (!gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, &groupiter)) { - char *collapsed = gaim_group_get_setting((GaimGroup *)node->parent, "collapsed"); gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0); newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); gtknode->row = gtk_tree_row_reference_new(GTK_TREE_MODEL(gtkblist->treemodel), newpath); gtk_tree_path_free(newpath); - if (!collapsed) - expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &groupiter); - else - g_free(collapsed); - if(expand) { - gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), expand, TRUE); - gtk_tree_path_free(expand); - } return iter; } Index: gtksound.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gtksound.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -p -r1.6 -r1.7 --- gtksound.c 23 Aug 2003 05:39:10 -0000 1.6 +++ gtksound.c 7 Sep 2003 15:55:28 -0000 1.7 @@ -311,10 +311,11 @@ GaimSoundUiOps *gaim_get_gtk_sound_ui_op static void _pref_sound_method_changed(const char *name, GaimPrefType type, gpointer val, gpointer data) { - sound_initialized = TRUE; - if(type != GAIM_PREF_STRING || strcmp(name, "/gaim/gtk/sound/method")) return; + + sound_initialized = TRUE; + #ifdef USE_AO ao_driver = -1; |