Re: [glade--]I get "segmentation fault" when i customazing a clas s created by glademm.
Christof Petig <[email protected]>
| Newsgroups | gmane.comp.gnome.glademm |
|---|---|
| Organization | Adolf Petig GmbH & Co. KG |
| Message-ID | <[email protected]> |
Dedov Anton wrote:
> Can I hope that if I would use gtkmm2 only (without glademm) and g++ 2.95 the things will be stable?
All works well unless you start using dynamic_cast within a ctor of a
derived class
e.g.
struct A
{ A() { this->a_method_which_uses_dynamic_cast(); }
};
struct B
{ int x;
B() : A(), x(1) {}
}
this will crash. It will not crash if you remove the x (the compile
optimizes B away) or if you call a_method_which_uses_dynamic_cast
after A() has ended (e.g. in a member or inside B()).
Since this is clearly a compiler bug and any workarounds are quite ugly
and most up to date distributions ship with g++-3.2 I'd recommend to
upgrade the compiler. You really get a better environment, 2.95 is
broken in many ways (e.g. standard conformance), produces larger code
and will die soon (hopefully).
I would accept a patch which moves the widget creation and customization
into an init function (actually add() uses dynamic_cast()), but I bet
the effort is better put into upgrading your compiler. Of course you can
replace the ctor of foo_glade by init and call that function from your
foo ctor but this means patching the generated file by hand (or patch).
Christof