Skip to content

gs-updates-section: Avoid crash when switching modes

Philip Withnall requested to merge pwithnall/gnome-software:mode-switches into master

Depending on how the _list_header_func() is called for different orders of rows and updates, it’s possible for the self->section_header to be set as the header for row A. In the next cycle of updates, if it’s set as the header for row B, and then the header is updated for row A (to be a normal separator), GTK+ will unparent the self->section_header and leave it parentless.

This causes the following critical:

gtk_widget_realize: assertion 'widget->priv->anchored || GTK_IS_INVISIBLE (widget)' failed
**
Gtk:ERROR:../../../../gtk/gtkwidget.c:12348:gtk_widget_real_map: assertion failed: (_gtk_widget_get_realized (widget))

The real fix for this is in GTK+, but in the meantime, we can improve the situation by using gtk_widget_unparent() (simpler), and only call it if the row’s header is going to change, rather than unconditionally unparenting the self->section_header.

Signed-off-by: Philip Withnall withnall@endlessm.com

Edited by Philip Withnall

Merge request reports