Why would you have and infinite loop continually setting the label's
text... and why would you create the label with "a" only to immediately
change it to "f" over and over?
Would simply using 'gtk_label_new ("f")' not suffice? Or perhapse a
'gtk_label_set_text (GTK_LABEL (mylabel), "f")' once PRIOR to going
into gtk_main () or your own loop?
Secondly, you can cast the GtkWidget into a label using 'GTK_LABEL
(mylabel)' rather than '(GtkLabel*)mylabel'
- Micah
www.micahcarrick.com | www.gtkforums.com
David L wrote:
I noticed one of my gtk applications seems to be
leaking memory on my fc6 box that I updated recently.
I think I've tracked it down to a leak in gtk_label_set_text.
The following simple example leaks on one of my computers
(an fc6 box with "yum update" run today... uses gtk2-2.10.4-8.fc6).
Am I doing something wrong or is there a gtk bug?
#include <gtk/gtk.h>
int main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
GtkWidget *window;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *vbox;
vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add (GTK_CONTAINER(window), vbox);
GtkWidget *mylabel = gtk_label_new("a");
gtk_box_pack_start(GTK_BOX(vbox), mylabel, FALSE, FALSE, 0);
gtk_widget_show_all(window);
while (1) {
gtk_main_iteration();
gtk_label_set_text((GtkLabel *)mylabel, "f");
}
}
Thanks,
David
_________________________________________________________________
Find sales, coupons, and free shipping, all in one place! MSN Shopping
Sales & Deals
http://shopping.msn.com/content/shp/?ctid=198,ptnrid=176,ptnrdata=200639
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
|