Bug 1898054 - Gtk::Builder::get_widget_derived() does not work as expected
Summary: Gtk::Builder::get_widget_derived() does not work as expected
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gtkmm30
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kalev Lember
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-11-16 09:45 UTC by aoz_2
Modified: 2020-11-28 02:04 UTC (History)
4 users (show)

Fixed In Version: gtkmm30-3.24.2-4.fc33
Clone Of:
Environment:
Last Closed: 2020-11-28 02:04:12 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Small example program to demonstrate the issue (1.87 KB, text/x-csrc)
2020-11-16 09:45 UTC, aoz_2
no flags Details

Description aoz_2 2020-11-16 09:45:26 UTC
Created attachment 1729734 [details]
Small example program to demonstrate the issue

Description of problem:
On Fedora 33, derived widgets do not seem to be constructed properly by Gtk::Builder::get_widget_derived() as the overridden methods are not called for these widgets. Apart from that everything seems normal. No error message or anything.


How reproducible:
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 Gtk::Builder::add_from_string(), then the widget created by Builder also works normally.

Comment 1 Kalev Lember 2020-11-17 07:02:46 UTC
Could you report this upstream at https://gitlab.gnome.org/GNOME/gtkmm/-/issues , please? We don't have any downstream code changes in Fedora and it's almost certainly an upstream issue.

Comment 2 Andrew Potter 2020-11-17 21:39:08 UTC
I believe this is caused by https://fedoraproject.org/wiki/LTOByDefault

If you "objdump  -C -S /usr/lib64/libgtkmm-3.0.so.1.1.0" you can see the Gtk::wrap_init function does not contain all the calls to e.g. Gtk::AboutDialog::get_type()

I built the srpm and noticed that the get_type() calls were present in wrap_init.o but was missing from the .so

I added 
%define _lto_cflags %{nil}
to the gtkmm .spec file and rebuilt; the get_type() were then present in the .so

This probably needs to be added to the spec file for all *mm packages.

Comment 3 Andrew Potter 2020-11-21 22:22:50 UTC
I've opened https://src.fedoraproject.org/rpms/gtkmm30/pull-request/3 to disable LTO. If that PR is doing the right thing I can go through the other -mm packages.

Comment 4 Kalev Lember 2020-11-24 12:15:18 UTC
Hey, thanks for the PR!

I think it would be better to get the upstream fix that's in glibmm24 (https://gitlab.gnome.org/GNOME/glibmm/-/commit/ceececea0f659bce5fff8835f1ed99238871a24c) into Fedora and then rebuild gtkmm30 and anything else that's affected. Let me quickly do that and then you can give it a try to see if it makes things work correctly for you.

Comment 5 Fedora Update System 2020-11-26 14:57:36 UTC
FEDORA-2020-e2d08f99e7 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-e2d08f99e7

Comment 6 Fedora Update System 2020-11-27 02:10:48 UTC
FEDORA-2020-e2d08f99e7 has been pushed to the Fedora 33 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-e2d08f99e7`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-e2d08f99e7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2020-11-28 02:04:12 UTC
FEDORA-2020-e2d08f99e7 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.