Mercurial > pidgin.yaz
comparison pidgin/gtkimhtmltoolbar.c @ 22825:28005860d2c9
Plug a small memory leak in the smiley dialog, and use g_new0/g_free
instead of malloc/free.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 07 May 2008 00:35:55 +0000 |
parents | 35d5b7804449 |
children | b8f861d7b540 ac567757d236 f9fd7ddf6996 |
comparison
equal
deleted
inserted
replaced
22824:29235834c692 | 22825:28005860d2c9 |
---|---|
618 GtkWidget *button; | 618 GtkWidget *button; |
619 GtkRequisition size; | 619 GtkRequisition size; |
620 struct smiley_button_list *cur; | 620 struct smiley_button_list *cur; |
621 struct smiley_button_list *it, *it_last; | 621 struct smiley_button_list *it, *it_last; |
622 | 622 |
623 cur = malloc(sizeof(struct smiley_button_list)); | 623 cur = g_new0(struct smiley_button_list, 1); |
624 it = ls; | 624 it = ls; |
625 it_last = ls; /* list iterators*/ | 625 it_last = ls; /* list iterators*/ |
626 image = gtk_image_new_from_file(filename); | 626 image = gtk_image_new_from_file(filename); |
627 | 627 |
628 gtk_widget_size_request(image, &size); | 628 gtk_widget_size_request(image, &size); |
730 | 730 |
731 /* create list of smileys sorted by height */ | 731 /* create list of smileys sorted by height */ |
732 while (unique_smileys) { | 732 while (unique_smileys) { |
733 GtkIMHtmlSmiley *smiley = unique_smileys->data; | 733 GtkIMHtmlSmiley *smiley = unique_smileys->data; |
734 if (!smiley->hidden) { | 734 if (!smiley->hidden) { |
735 fflush(stdout); | |
736 ls = sort_smileys(ls, toolbar, &max_line_width, smiley->file, smiley->smile); | 735 ls = sort_smileys(ls, toolbar, &max_line_width, smiley->file, smiley->smile); |
737 } | 736 } |
738 unique_smileys = unique_smileys->next; | 737 unique_smileys = g_slist_delete_link(unique_smileys, unique_smileys); |
739 } | 738 } |
740 /* pack buttons of the list */ | 739 /* pack buttons of the list */ |
741 max_line_width = max_line_width / num_lines; | 740 max_line_width = max_line_width / num_lines; |
742 it = ls; | 741 it = ls; |
743 while (it != NULL) | 742 while (it != NULL) |
752 line_width = 0; | 751 line_width = 0; |
753 col = 0; | 752 col = 0; |
754 } | 753 } |
755 col++; | 754 col++; |
756 it = it->next; | 755 it = it->next; |
757 free(it_tmp); | 756 g_free(it_tmp); |
758 } | 757 } |
759 gtk_box_pack_start(GTK_BOX(smiley_table), line, FALSE, TRUE, 0); | 758 gtk_box_pack_start(GTK_BOX(smiley_table), line, FALSE, TRUE, 0); |
760 | 759 |
761 gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK); | 760 gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK); |
762 } | 761 } |