GNOME Bugzilla – Bug 719595
Toolbar style context is created before style class toolbar is added.
Last modified: 2014-11-28 14:00:34 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.
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.
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.
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.
Attachment 263201 [details] pushed as d31f3e5 - Add class toolbar before the style context is created for the widget.
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.)
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.
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?