From: Masao M. <mu...@hi...> - 2002-07-05 16:28:15
|
Hi, On Thu, 4 Jul 2002 18:21:27 +0200 Matthias Veit <mat...@ya...> wrote: > > Hi, > Now, the gtk object predefined1 is destroyed, what is really not > intended, because it shall be possible to add predefined1 to window > again - what is not possible. > > This situation works in C only, if I ref (gtk_widget_ref) predefined1 > before delete - but there is no pendant in ruby-gtk. > Because I have a valid ruby-reference, this is not really straight. > > Do I make something wrong? I think Ruby/GTK's implement is bad now, because it can't keep object strictly as follows: 1. When ruby wrapper is finalized, gtk-object should be finalized(destroyed). 2. When gtk-object is destroyed(finalized), ruby wrapper shuold be finalized. > - then a simple ref, before delete is a fast solution. ref/unref system is too complicated. I want to hide them from Ruby/GTK's users. So I will not support ref/unref methods obviously in Ruby/GTK an Ruby/GTK2. > PS: simple test script is attached - a click on 'press me' will fail Hmm, I think Gtk::Container#remove destroy child is strange. button1.signal_connect('clicked') { |*args| hbox.remove(button2) puts button2.clicked() #<- Destroyed? why? } Same code in Ruby: str = "test" hbox = Array.new hbox.push(str) #Same as Gtk::Container#add hbox.delete(str) #Same as Gtk::Container#remove p str # -> "test" not destroyed. So I think it is better not to destroy gtk-object in Gtk::Container#remove. Any comments/ideas? -- .:% Masao Mutoh<mu...@hi...> |