Re: implementing custom GtkTreeModels for language bindings

Owen Taylor <[email protected]> Sat, 26 Nov 2005 10:57:31 -0500
Newsgroups gmane.comp.gnome.gtk+.general,gmane.comp.gnome.language-bindings
Message-ID <1133020651.2939.22.camel@huygens>
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

_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQBDiIXrS+2LB0B90LERAi/IAKDRcwTEDE+HUoiXpgvYgWrW8TdplwCgiKgZ
zrb5anKk7K0CmKtrQxnaazc=
=6OoM
-----END PGP SIGNATURE-----