Skip to content

gtk: Replace GtkCssStyle with GtkStyleContext in GtkCssBoxes

Maxim Zakharov requested to merge Maxime2/gtk:gtk_css_boxes-fix into master

Fixes access to already dereferenced style objects after gtk_style_context_lookup_style() is called, e.g. in gtk_style_context_save().

This is followup to !4111 (closed)

@otte your proposal to use gtk_style_context_save() and gtk_style_context_restore() does not solve the crashes because snapshot() receives already saved context in gtk_cell_renderer_snapshot which also adds 'cell' class to the context before calling snaphot(), that causes style to be recalculated in the next call of gtk_style_context_lookup_style(), which happens in gtk_style_context_save() when context has already been saved.

I have modified GTkCssBoxes to store GtkStyleContext instead of GtkCssStyle which remains referenced during snaphot() execution. This fix solves the crashed in snapshot().

Merge request reports