Re: Glib::Object and Gtk::Window multiple inheritance



I've tried this before

class Base : public virtual Glib::Object
[...]

but the problem remains

According to [2], i should modify Gtk::Window to inherit Glib::Object
virtually too, but i can not do that.

Regards:
Imre

2012. 10. 7, vasárnap keltezéssel 20.29-kor Florian Philipp ezt írta:
> Am 07.10.2012 18:21, schrieb Horváth Imre:
> > Hi!
> > 
> > I want to create a base class for my window and dialog classes, the
> > structure looks lik this:
> > 
> > class Base : public Glib::Object
> [...]
> > 
> > class WindowBase : public Base, public Gtk::Window
> [...]
> > 
> > class DialogBase : public Base, public Gtk::Dialog
> [...]
> > 
> > class MyWindow : public WindowBase
> [...]
> 
> > 
> > When i want to instantiate the MyWindow, I get the following error:
> > glibmm:ERROR:objectbase.cc:78:void
> > Glib::ObjectBase::initialize(GObject*): assertion failed: (gobject_ ==
> > castitem)
> > 
> > I think it's because the multiple inheritance of Glib::Object from Base
> > and from Gtk::Window, but I can not find a solution.
> > 
> 
> Please look at [1] and [2]. Adding virtual inheritance of Glib::Object
> should fix your problem.
> 
> [1] http://en.wikipedia.org/wiki/Diamond_problem#The_diamond_problem
> [2] http://en.wikipedia.org/wiki/Virtual_inheritance
> 
> Regards,
> Florian Philipp
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> https://mail.gnome.org/mailman/listinfo/gtkmm-list




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