From: Laurent Sansonetti Date: 2004-03-17T03:06:19+09:00 Subject: Re: [Ruby-gnome2] possible bug in memory management Hi David, On Tue, 2004-03-16 at 13:49, David Espada wrote: > Hi all. > > I have found a reproducible bug, but I don't know if it is in Gtk2 > library, Ruby or Ruby-gtk2. > > You can execute this little program: > > ------------------------------------------- > #!/usr/bin/ruby > > require 'glib2' > require 'gtk2' > > def bucle > 100000.times do |i| > p i > v = Gtk::Window.new.show_all > v.destroy > end > end > > Gtk::init > > ventana = Gtk::Window.new > ventana.set_title("Creating windows") > ventana.signal_connect('delete_event') {exit} > > > vbox = Gtk::VBox::new(true, 10) > > boton = Gtk::Button.new('_loop', true) > boton.signal_connect('clicked') do bucle end > vbox.pack_start(boton, true, true, 0) > > ventana.add(vbox) > > ventana.show_all > > Gtk.main > ------------------------------------------ > > Depending of system memory, program fails before or after. Error > consist in program freeze. If I understand correctly the problem is that you're executing an operation which takes some time in the main thread, which takes care of periodically refreshing the UI. So it's quite normal if the program freezes. You should start the signal code in a separate thread. -- Laurent