mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
Merge branch 'gtkstack_fix_pages_param_check' into 'main'
stack: fix pages list bounds check See merge request GNOME/gtk!6141
This commit is contained in:
commit
b61991a023
@ -617,8 +617,7 @@ gtk_stack_pages_get_item (GListModel *model,
|
||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (pages->stack);
|
||||
GtkStackPage *page;
|
||||
|
||||
|
||||
if (position > priv->children->len - 1)
|
||||
if (position >= priv->children->len)
|
||||
return NULL;
|
||||
|
||||
page = g_ptr_array_index (priv->children, position);
|
||||
@ -642,7 +641,7 @@ gtk_stack_pages_is_selected (GtkSelectionModel *model,
|
||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (pages->stack);
|
||||
GtkStackPage *page;
|
||||
|
||||
if (position > priv->children->len - 1)
|
||||
if (position >= priv->children->len)
|
||||
return FALSE;
|
||||
|
||||
page = g_ptr_array_index (priv->children, position);
|
||||
@ -664,6 +663,9 @@ gtk_stack_pages_select_item (GtkSelectionModel *model,
|
||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (pages->stack);
|
||||
GtkStackPage *page;
|
||||
|
||||
if (position >= priv->children->len)
|
||||
return FALSE;
|
||||
|
||||
page = g_ptr_array_index (priv->children, position);
|
||||
|
||||
set_visible_child (pages->stack, page, priv->transition_type, priv->transition_duration);
|
||||
@ -813,7 +815,7 @@ gtk_stack_accessible_get_first_accessible_child (GtkAccessible *accessible)
|
||||
|
||||
if (priv->children->len > 0)
|
||||
page_accessible = GTK_ACCESSIBLE (g_object_ref (g_ptr_array_index (priv->children, 0)));
|
||||
|
||||
|
||||
return page_accessible;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user