Re: Gtk::Builder::get_widget_derived() Issue on Fedora 33
- From: ahmet öztürk <bilheps gmail com>
- To: Andrew Potter <agpotter gmail com>
- Cc: Kjell Ahlstedt <kjellahlstedt gmail com>, gtkmm-list <gtkmm-list gnome org>
- Subject: Re: Gtk::Builder::get_widget_derived() Issue on Fedora 33
- Date: Tue, 17 Nov 2020 11:01:26 +0300
But why does it only occur on Fedora 33?
@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.
I think the cause is the G_GNUC_CONST annotation on TextView::get_type().
When I step through the code on Fedora 33, in Gtk::wrap_init, all the wrap_registers happen, but the function just returns, skipping the calls to e.g. TextView::get_type()
Ahmet can use g_type_ensure(TVDerived::get_type()) rather than default constructing the class.
Hi Kjell,
Thank you for the response. I tried your suggestion and the outputs were exactly as you guessed. So, this seems like a Fedora specific issue. I will be filing a bug report there.
On 2020-11-14 14:56, ahmet öztürk via gtkmm-list wrote:
> Hi all,
>
> On Fedora 33, derived widgets does not seem to be constructed properly
> by Gtk::Builder::get_widget_derived(). The reason I think so is that
> the overridden methods are not called for these widgets. Apart from
> that everything seems normal. No error message or anything.
>
> I attached a sample code with a very simple case to replicate this
> problem. on_button_press_event() is never called for the derived widget.
>
> I have also noticed that if a dummy instance of the derived widget is
> created separately (using another constructor) before calling
> Gkt::Builder::add_from_string(), then the widget created by Builder
> also works normally.
>
> Please note that this may not occur on all distributions. e.g. I know
> that it does not occur on Arch Linux.
>
> Does anybody know if this a Fedora 33 specific issue or is it due to a
> recent update in Gtkmm that is only affecting Fedora for now?
>
The issue does not occur on Ubuntu 20.04 with the latest gtk+3 and
gtkmm3 from the git repo.
It looks as if the gtkmm__GtkTextView class has not been registered in
the GType system before get_widget_derived() is called. That should have
been done by Gtk::wrap_init() which is called from
Gtk::Application::create().
You can test if I'm right. Add
std::cout << "GType name: " <<
G_OBJECT_TYPE_NAME(m_TextView->gobj()) << std::endl;
after the call to get_widget_derived(). When the overloaded function is
not called, I suspect that the output will be
GType name: GtkTextView
When you've uncommented TVDerived dummy;, and everything is okay, the
output is probably
GType name: gtkmm__GtkTextView
If I'm right, it looks like a Fedora specific issue. It can't be due to
a recent update in gtkmm (I've tested with the very latest one), unless
there is some Fedora specific update.
_______________________________________________
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]