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

D

David Espada

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top