Re: custom TreeModel

--- Jonathon Jongsma <jonathon jongsma gmail com>

> actually, I believe most of the warnings I was
> talking about were
> run-time warnings, not compiler warnings.  I hadn't
> really noticed any
> compiler warnings -- maybe there were some and I
> missed them though.
> I was able to compile just fine without virtual
> inheritance, but I
> would get runtime warnings on the commandline when I
> ran the example
> and it didn't populate the treeview.  Did it
> populate the treeview for
> you when you didn't use virtual inheritance?
> I get the following output and nothing shows up in
> the treeview:
> --------------------
> $ ./src/testcustomtreemodel
> setting up Main
> setting up win
> Constructing vector container
> Adding item 1
> Adding item 2
> Adding item 3
> Adding item 4
> Adding item 5
> Creating custom treemodel
> (testcustomtreemodel:1068): glibmm-CRITICAL **:
> Glib::Interface::Interface(const
> Glib::Interface_Class&): assertion
> `gobject_ != 0' failed
> creating tree view
> (testcustomtreemodel:1068): glibmm-WARNING **:
> Glib::ConstructParams::ConstructParams(): invalid
> object type
> `gtkmm__CustomObject_15SimpleTreeModel' for value
> type `GtkTreeModel'
> Appending column
> Adding treeview to window
> Showing all
> --------------------
> Do you get those as well, or did it work for you?
I reused your tarball after adjusting so
configure can work with my version of gtkmm. It
compiled well and worked well. I then removed virtual
inheritance. This time it gave me the same runtime
warnings you mentioned. However my own version worked
fine. I discovered that as I fixed the compile-time
warnings of order of instantiation of base classes,
this has also fixed the runtime behavior.
The bottom line is just modify your class declaration
so Glib::Object comes first!. You can even modify it
in the header file alone, it will produce the
compile-time warnings but it will work fine! Better is
to modify both the declaration, and the instantiation
order in the constructor to get rid of the compiler's
warnings as well.
By the way you don't get compiler warnings because you
don't have -Wall in your AM_CXXFLAGS in


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

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