visualizer-group: Fix insert()

sysprof_visualizer_group_insert() would insert widgets intended for
position 0 at position 1 instead. This caused a bug in the marks section
where the "Timings" row, which is supposed to be at the top, would
instead be at position 1. Because the menu buttons are in the top row,
disabling a row through the menu could cause the menu buttons to
disappear.
This commit is contained in:
James Westman
2023-02-21 17:21:28 -06:00
parent 5c06845e86
commit 49c57c4a6f

View File

@ -392,11 +392,14 @@ sysprof_visualizer_group_insert (SysprofVisualizerGroup *self,
g_return_if_fail (SYSPROF_IS_VISUALIZER_GROUP (self));
g_return_if_fail (SYSPROF_IS_VISUALIZER (visualizer));
sibling = gtk_widget_get_first_child (GTK_WIDGET (priv->visualizers));
while (position > 1 && sibling)
if (position > 0)
{
sibling = gtk_widget_get_next_sibling (sibling);
position--;
sibling = gtk_widget_get_first_child (GTK_WIDGET (priv->visualizers));
while (position > 1 && sibling)
{
sibling = gtk_widget_get_next_sibling (sibling);
position--;
}
}
gtk_box_insert_child_after (priv->visualizers, GTK_WIDGET (visualizer), sibling);