Re: [gtkmm] Storing Glib::RefPtrs in treemodels



> I have a Gtk::TreeStore subclass which has as one of its columns a
> Glib::TreeModelColumn<Glib::RefPtr<Towel::TrackStore> > where
> Towel::TrackStore is a subclass of Gtk::ListStore. When a row is added
> to this TreeStore, the relevant column is populated with
> Towel::TrackStore::create(), which returns a RefPtr with a TrackStore
> inside it as one might expect.
> 

What are you trying to do here?  Why do you want to display a Gtk::ListStore
in a Gtk::TreeView?  

> The trouble is, every time the program tries to access the column, Glib
> claims
> 
> (towel:9825): GLib-GObject-CRITICAL **: file gobject.c: line 1583
> (g_value_get_object): assertion `G_VALUE_HOLDS_OBJECT (value)' failed
> 

That's probably because there is no CellRenderer that can display 
such a column.  

> And I have no idea why this might be, because I am sure that
> everything's being created properly. Do I perhaps not understand how
> RefPtrs work properly? Should I perhaps be doing this in a completely
> different manner? I suppose I could store straight pointers instead, but
> that would increase the complexity of the memory management code, which
> I'm trying not to do because it's a horrible source of nasty bugs.
> 

It looks like you want to store this as data in the model.  That's fine;
as long as you don't add that column to the view, you won't have any 
problem.  But if you're trying to display this, you're doing the wrong
thing.

cheers,
--
joey yandle






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