After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719595 - Toolbar style context is created before style class toolbar is added.
Toolbar style context is created before style class toolbar is added.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkToolbar
3.11.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 690236
 
 
Reported: 2013-11-30 11:36 UTC by Marco Brito
Modified: 2014-11-28 14:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add class toolbar before the style context is created for the widget. (755 bytes, patch)
2013-11-30 11:36 UTC, Marco Brito
committed Details | Review

Description Marco Brito 2013-11-30 11:36:30 UTC
Created attachment 263201 [details] [review]
Add class toolbar before the style context is created for the widget.

From https://bugzilla.gnome.org/show_bug.cgi?id=690236


At gtk_toolbar_init, gtk_button_set_relief uses get_button_relief that calls gtk_widget_style_get. As the widget is initializing a new style context is created, but this happens before the toolbar's style class "toolbar" is added to the widget.


This patch reorders gtk_style_context_add_class call to before the first access of a style property.
Comment 1 Adam Dingle 2013-11-30 12:30:57 UTC
Marco, thanks for the patch.  I just built GTK from git master including your patch.  I can confirm that bug 690236 does not occur with this patched GTK.
Comment 2 Felix Riemann 2013-12-01 13:58:13 UTC
Indeed, the patch seems to help.
Although I wonder whether setting the style should happen before or after setting the widget's private data pointer.
Comment 3 Matthias Clasen 2013-12-01 17:37:51 UTC
Review of attachment 263201 [details] [review]:

Great detective work!

I agree with Felix that it would be best to keep the initialization of priv as the first thing in the function, other than that, looks good.
Comment 4 Matthias Clasen 2013-12-01 22:20:51 UTC
Attachment 263201 [details] pushed as d31f3e5 - Add class toolbar before the style context is created for the widget.
Comment 5 Adam Dingle 2013-12-02 01:58:46 UTC
Matthias, thanks for pushing this to master and 3.10.  It would be nice to push this to the 3.8 branch as well since some distributions are still shipping that GTK.  (I'm happy to cherry pick this there if that's OK, or you could.)
Comment 6 Marco Brito 2013-12-03 14:53:38 UTC
To late for the reply.
This way was the first thing that came to my mind, but i recognize the point about having private data being first looks better.
But i see that is already commited.

Then, for the next time.
Comment 7 pabouk 2014-11-28 14:00:34 UTC
This bug was opened because of the "window opened with several pixels smaller height than needed" bug observed in Eye of GNOME:
https://bugzilla.gnome.org/show_bug.cgi?id=690236

Unfortunately in Ubuntu 14.04 which contains GTK+ 3.10.8 there is the same problem in Eye of GNOME. Could not there be any change which cancels effect of the fix?