Re: Getting rid of ListStores




John M. Burian wrote:
I have an application that creates and destroys a fair number of
ComboBoxes, each of which requires a TreeModel (I'm using ListStores). I
understand that I can use the same model for multiple ComboBoxes. The
question is, ListStores aren't widgets, they don't have a destroy()
method, so do they behave like plain ol' Perl data structures? That is,
they persist so long as a reference is being held somewhere, but then
get automatically garbage collected? Is Gtk okay with that?

Yes, they are supposed to behave like normal perl objects, which die when the
last reference goes away.  A wrinkle is that references held by gtk objects
count, so you can have no perl references to object, but it will still live
because a C object has a reference to it.  (This is A Very Good Thing.)

Be warned, however, that closures connected to signals, as well as user data
parameters, take references on these objects, so it is very easy to create
reference leaks by sloppy coding.


-- 
muppet <scott at asofyet dot org>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]