After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 559240 - program gets bigger and bigger
program gets bigger and bigger
Status: RESOLVED DUPLICATE of bug 558594
Product: gtk+
Classification: Platform
Component: Widget: Other
2.6.x
Other All
: Normal critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-11-04 09:02 UTC by Jacques Le Normand
Modified: 2008-11-04 09:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jacques Le Normand 2008-11-04 09:02:30 UTC
Please describe the problem:
when you run this program, it just keeps getting bigger:

/*      gcc -Wall -g test.c -o test2 `pkg-config --cflags gtk+-2.0` `pkg-config
--libs gtk+-2.0` */
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>


GtkWidget *entry;
GtkWidget *vbox;


void do_it(){
  GList *iter;
  GList *original_iter;
  iter = original_iter = gtk_container_get_children (GTK_CONTAINER (vbox));
  while(iter){
    GtkWidget *child;
    child = iter->data;
    iter  = iter->next;
    gtk_container_remove(GTK_CONTAINER(vbox),child);

  }
  g_list_free(original_iter);
  int i;
  for( i = 0 ; i < 2000 ; i++){
    entry = gtk_entry_new ();
    gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
    gtk_widget_show (entry); 
  }

}

void do_it_many_times (){
    int i;
    for(i = 0 ; i< 10000;  i++){
      do_it();
    }
	
}

guint test_function(gpointer data){
  do_it_many_times();
  return 0;
}

int main( int   argc,
          char *argv[] )
{
  int time_interval = 3000;
    GtkWidget *window;
    gtk_init (&argc, &argv);

    /* create a new window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
    gtk_window_set_title (GTK_WINDOW (window), "GTK Entry");
    g_signal_connect (G_OBJECT (window), "destroy",
                      G_CALLBACK (gtk_main_quit), NULL);
    g_signal_connect_swapped (G_OBJECT (window), "delete_event",
                              G_CALLBACK (gtk_widget_destroy), 
                              G_OBJECT (window));








    vbox = gtk_vbox_new (FALSE, 0);
    gtk_container_add (GTK_CONTAINER (window), vbox);
    gtk_widget_show (vbox); 
    
    g_timeout_add(time_interval,(GSourceFunc) test_function,0);

    gtk_widget_show (window);

    gtk_main();

    return 0;
}



Steps to reproduce:
1. compile 
2. run
3. 


Actual results:
the program keeps getting bigger

Expected results:
the program doesn't keep getting bigger

Does this happen every time?
yes

Other information:
valgrind doesn't show much, related (but somewhat different) from 558594. The problem is much clearer with this program.
Comment 1 Tor Lillqvist 2008-11-04 09:40:01 UTC
Just attach the new test program to bug #558594 then (as a single source file), don't file a new bug.

*** This bug has been marked as a duplicate of 558594 ***