Re: implementing custom GtkTreeModels for language bindings



On Fri, 2005-11-25 at 16:12 +0000, Duncan Coutts wrote:
> All,
> 
> Language bindings want to be able to implement the GtkTreeModel
> interface. Unfortunately this is rather hard without causing a space
> leak.
> 
> The issue is that to implement a the GtkTreeModel interface you must
> fill in GtkTreeIter structures. These are typically stack allocated and
> do not need to be explicitly freed. As a consequence it is not possible
> to track resources that are referenced by GtkTreeIters.

The simplest fix for this is to to use iters that don't reference
resources - put 1-3 integers into the iterator instead of a pointer.
It's easy to see how to do this for a flat model. A little trickier
for a tree, but there are various possibilities ... 

(You may have to omit GTK_TREE_MODEL_ITERS_PERSIST - this will cause
some performance degradation, but things will still work.)

Regards,
						Owen

Attachment: signature.asc
Description: This is a digitally signed message part



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