Re: Gtk2::TreePath broken on Debian?



On 19.04.2010 22:34, Matthew Braid wrote:
I thought paths were safe to carry around between changes, but iters
were the things that lasted only a short time?

Both are rather equivalent in this regard. Under the hood, both, GtkTreeIter and GtkTreePath, are "boxed" objects that are not ref-counted. So there's no way for the bindings to say "I'm still using this object" to prevent others from invalidating it. The $tpath that is handed to you in the foreach callback will in general be invalid after you returned from that callback. By using $tpath->copy, you make a private copy that is valid as long as the variable holding it is in scope. Alternatively, you could also serialize the path to a set of indices or to a string and then later recreate a path object from this data.

Also, this code was working perfectly on FreeBSD, just not on Debian.
Did a rule about the life of a path change between the versions I
have?

Sounds like you were just lucky on FreeBSD.



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