Re: Gtk::Builder::get_widget_derived() Issue on Fedora 33




On Tue, Nov 17, 2020 at 12:01 AM ahmet öztürk <bilheps gmail com> wrote:
Is this a Gtkmm issue then? Fedora guys also think that it is an upstream issue. See:https://bugzilla.redhat.com/show_bug.cgi?id=1898054
But why does it only occur on Fedora 33?
 
Likely its due to a new optimization in gcc 10 which few other distros are using yet.
Since the GtkFoo::get_type() calls in wrap_init() are not using the return value, it makes sense to me that they are eligible for dead code elimination, as is suggested in the blog post. Since Gtkmm is calling these methods explicitly to ensure the GTypes are made known, I think fixing it in Gtkmm by adding g_type_ensure() is the path of least resistance.

@Andrew, I do not know how I am supposed to use g_type_ensure(TVDerived::get_type()). I am not familiar with Gtk+ or GObject, I have only used Gtkmm, so far.

You can simply replace TVDerived dummy; with g_type_ensure(TVDerived::get_type()); in your example program.

For a more professional look, you can define an init() function that calls g_type_ensure() for all of your custom derived types and call it in main()--but I guess you should explicitly call Gtk::Main::init_gtkmm_internals() before your init() ala https://developer.gnome.org/gtkmm-tutorial/stable/sec-wrapping-initialization.html.en



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