[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ruby-gnome2] Objects that doesn't destroy?

David Espada

12/27/2004 9:04:00 AM


Hello all.

I think I have a problem with ruby-gtk2 and objects that does not
destroy, like Gtk::TextBuffer or Gtk::ListStore.

Example: Imagine I have this class:

-------------------------------------------
class Texto < Gtk::ScrolledWindow
def initialize
super()
@view = Gtk.TextView.new
@buffer = @view.buffer
add(@view)
end
end
-------------------------------------------

This class go inside a Window, and when I destroy window, all widgets
are destroyed. But @buffer points to a Gtk::TextBuffer object, that it
is not widget and it is not destroyed (or so I think after using a
rutine that shows me which objects in ObjectSpace are destroyed or
not).

I have tried destroying @buffer adding next code in initialize:

@view.signal_connect('destroy') do
@buffer.destroy
end

But with this code, I get a segment fault ([BUG]) when I try to destroy
window.

My question is: Is it necessary to destroy buffer or is it destroyed
automatically by ruby garbage collection?

I see same behaviour with classes relatives to Gtk::TreeView, like
Gtk::ListStore, Gtk::TreeSelection, etc...

Please, Help!!

Oh... and happy christmas :)

David