Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 18646:05cab350d1fb
Fix memory leak by freeing the list returned by gtk_container_get_children.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 27 Jul 2007 10:44:11 +0000 |
parents | e47ff6610fc7 |
children | 2848d536ac7e |
comparison
equal
deleted
inserted
replaced
18645:9e55f853a6fa | 18646:05cab350d1fb |
---|---|
2973 | 2973 |
2974 /* Remove the previous entries */ | 2974 /* Remove the previous entries */ |
2975 for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; ) | 2975 for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; ) |
2976 { | 2976 { |
2977 GtkWidget *w = list->data; | 2977 GtkWidget *w = list->data; |
2978 list = list->next; | 2978 list = g_list_delete_link(list, list); |
2979 gtk_widget_destroy(w); | 2979 gtk_widget_destroy(w); |
2980 } | 2980 } |
2981 | 2981 |
2982 /* Now add the stuff */ | 2982 /* Now add the stuff */ |
2983 if (node) | 2983 if (node) |
2990 if ((list = gtk_container_get_children(GTK_CONTAINER(menu))) == NULL) | 2990 if ((list = gtk_container_get_children(GTK_CONTAINER(menu))) == NULL) |
2991 { | 2991 { |
2992 GtkWidget *item = gtk_menu_item_new_with_label(_("No actions available")); | 2992 GtkWidget *item = gtk_menu_item_new_with_label(_("No actions available")); |
2993 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | 2993 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
2994 gtk_widget_set_sensitive(item, FALSE); | 2994 gtk_widget_set_sensitive(item, FALSE); |
2995 } | |
2996 else | |
2997 { | |
2998 g_list_free(list); | |
2995 } | 2999 } |
2996 | 3000 |
2997 gtk_widget_show_all(menu); | 3001 gtk_widget_show_all(menu); |
2998 } | 3002 } |
2999 | 3003 |
3371 menu = gtk_menu_item_get_submenu( | 3375 menu = gtk_menu_item_get_submenu( |
3372 GTK_MENU_ITEM(win->menu.send_to)); | 3376 GTK_MENU_ITEM(win->menu.send_to)); |
3373 | 3377 |
3374 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | 3378 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); |
3375 child != NULL; | 3379 child != NULL; |
3376 child = child->next) { | 3380 child = g_list_delete_link(child, child)) { |
3377 | 3381 |
3378 GtkWidget *item = child->data; | 3382 GtkWidget *item = child->data; |
3379 PurpleBuddy *item_buddy; | 3383 PurpleBuddy *item_buddy; |
3380 PurpleAccount *item_account = g_object_get_data(G_OBJECT(item), "purple_account"); | 3384 PurpleAccount *item_account = g_object_get_data(G_OBJECT(item), "purple_account"); |
3381 gchar *buddy_name = g_object_get_data(G_OBJECT(item), | 3385 gchar *buddy_name = g_object_get_data(G_OBJECT(item), |