mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-15 13:10:08 +00:00
listbox: Fix a crash during keynav
The code was asserting something that was not always holding true. We can hit row == NULL here on page-up too. Handle that case by moving to the first row. https://bugzilla.gnome.org/show_bug.cgi?id=791549
This commit is contained in:
parent
e834a2b089
commit
11bfce3f36
@ -3088,17 +3088,20 @@ gtk_list_box_move_cursor (GtkListBox *box,
|
||||
GSequenceIter *cursor_iter;
|
||||
GSequenceIter *next_iter;
|
||||
|
||||
/* A NULL row should only happen when the list box didn't
|
||||
* have enough rows to fill its height and the user made
|
||||
* a page movement down, so the count must be positive */
|
||||
g_assert (count > 0);
|
||||
|
||||
cursor_iter = ROW_PRIV (priv->cursor_row)->iter;
|
||||
next_iter = gtk_list_box_get_last_visible (box, cursor_iter);
|
||||
|
||||
if (next_iter)
|
||||
if (count > 0)
|
||||
{
|
||||
row = g_sequence_get (next_iter);
|
||||
cursor_iter = ROW_PRIV (priv->cursor_row)->iter;
|
||||
next_iter = gtk_list_box_get_last_visible (box, cursor_iter);
|
||||
|
||||
if (next_iter)
|
||||
{
|
||||
row = g_sequence_get (next_iter);
|
||||
end_y = ROW_PRIV (row)->y;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
row = gtk_list_box_get_row_at_index (box, 0);
|
||||
end_y = ROW_PRIV (row)->y;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user