From: Sutou K. <ko...@co...> - 2021-11-24 20:44:39
|
Hi, In <dfa...@pr...> "[ruby-gnome2-devel-en] How to release memory of unused widgets?" on Wed, 24 Nov 2021 16:00:23 +0100, Leonard Thiele <th...@pr...> wrote: > I wonder how I am supposed to release memory after I do not need a > widget anymore. > Should I use destroy()? Or unref()? Or is the binding taking care of > releasing memory after I removed the widget from its parent and I do > not have to worry? Removed widgets are released when Ruby's GC is ran. You can use Gtk::Widget#destroy explicitly when you can't wait Ruby's GC. > In a more complex project I am working on I use a FileChooserWidget > which causes segmentation faults when I destroy it and afterwards > change folder content which I previously watched. > This is because the FileChooserWidget does not properly clean up after > itself when I call destroy() on it and so it tries to execute > callbacks that make no sense after destroying... Could you file an issue to https://github.com/ruby-gnome/ruby-gnome/issues with a sample script that reproduces this case? Thanks, -- kou |