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

Discussion in 'Ruby' started by David Espada, Dec 27, 2004.

  1. David Espada

    David Espada Guest

    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
     
    David Espada, Dec 27, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dnZlbms=?=

    Should I explicitly destroy objects

    =?Utf-8?B?dnZlbms=?=, Nov 9, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    2,925
    Chris Botha
    Nov 10, 2005
  2. Ook
    Replies:
    2
    Views:
    344
  3. muler
    Replies:
    11
    Views:
    729
    James Kanze
    Dec 14, 2009
  4. David Espada
    Replies:
    2
    Views:
    157
    David Espada
    Jul 1, 2004
  5. Replies:
    2
    Views:
    166
Loading...

Share This Page