On Sat, 2007-07-14 at 02:57 +0900, Masahiro S. wrote:
Hmm, what are the technical difficulties?
As always, one big problem is memory management.
If we represent nodes of treemodel as ruby objects, we need to manage
them with ruby’s garbage collection. But they are refered by
GtkTreeIter and we cannot keep track of the usages of GtkTreeIter.
After all, I don’t know the precise condition when we should protect a
node from garbage collection and when we shouldn’t.
I’m thinking of the Java Swing TreeModel interface. A TreeModel subclass
would have it’s own (Ruby) storage mechanism for objects in the tree.
Say the storage mechanism used Array instances. Any nodes in the tree
would end up as items in arrays, which I think would take care of one
part of the garbage collection issue.
The other part could possibly be to have Ruby iterator objects that act
as wrappers for GtkTreeIter objects. That way, if a ruby node has been
removed from the TreeModel’s storage mechanism but an iterator still
refers to it, the iterator will be bound to a Ruby object and so it
won’t be garbage collected until the iterator object is ready to be
Another reason is that we don’t have satisfactory basis for
implementing gobject types in ruby yet. I think we need it first
before supporting custom treemodel.
I won’t make a suggestion here, because I don’t know enough about how
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.