Re: custom treemodel?



On 5/17/06, Murray Cumming <murrayc murrayc com> wrote:
It's all to do with the fact that you don't have much control over when
the per-iter data is deallocated. You just get to say "everything I have
allocated before now is now invalid, so I'll release it and it's your own
dam fault if you try to use it.". You do that by increasing the value of
stamp.

So I guess I keep a GlueList so I can release it when I do that
invalidation. And I guess I have a GlueItem for each iter, to be neat and
generic.

I don't think I actually invalidate the iters. And I don't think that
ListStore or TreeStore ever do that either, so it's a bit theoretical.
Maybe ListStore gets away with this (without memory leaks when iters are
forgetten) by just using basic types instead of extra memory for each
iter. Just guessing.


OK, I think I get it now, more or less.  I've just noticed, however
that when I run the example from gtkmm CVS, I get the following
warning:

(lt-example:29959): GLib-GObject-WARNING **: cannot add interface type
`GtkTreeModel' to type `gtkmm__CustomObject_16ExampleTreeModel', since
type `gtkmm__CustomObject_16ExampleTreeModel' already conforms to
interface

It seems to be caused by the following lines in the constructor:
 GType gtype = G_OBJECT_TYPE(gobj()); //The custom GType created in
the Object constructor, from the typeid.
 Gtk::TreeModel::add_interface( gtype );

I don't have a lot of experience with GObject stuff, so I have no idea
whether these should be necessary or not.  But it seems to run fine
and doesn't issue a warning when those lines are commented out.  Any
thoughts?

Jonner



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