Re: signals versus vfuncs



muppet schrieb:
another point of contention: GtkTreeIters are designed to be used by
allocation on the stack, and as such, have no destructors.  the boxed free
function is just g_free().  this means i have no hook on iter destruction,

IIRC g_free is not used at all (on stack data silently exits scope and lifetime).

which means that if i want to store a perl scalar inside (which makes the iter
useful in model implementations), i have to leak that structure in order for
it to live long enough to be useful.  (without going into the gory details, it
has to do with garbage collection and scalar lifetimes.  we're looking into
workarounds, but so far they are perverse and unnatural.)  this is not good,
of course.

is there any way at all to get notification when an iter is no longer in use? perhaps there's something simple i'm missing...

There is a way to get notification: Who but the perl program would ever create or delete nodes? You have ultimate control over the contents and lifetime of each and every node. The TreeView simply assumes that iterators are valid until a signal from the Store occurs. [And if the model is stable only affected iterators are invalidated]

Which - given possible garbage collection - might be difficult to achieve. You need to describe your objects by up to three C pointers (which should not change unless the model changes). Feel free to simply store an index into something.

   Christof




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