[gtk+] listbox: Fix a crash during keynav
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] listbox: Fix a crash during keynav
- Date: Fri, 15 Dec 2017 23:49:04 +0000 (UTC)
commit 4573d2d19b91a1c4152e74b0582d36a8b0f2dc13
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Dec 15 18:46:21 2017 -0500
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
gtk/gtklistbox.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index a3c638d..6d704c5 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -2832,17 +2832,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)
+ {
+ 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 = g_sequence_get (next_iter);
+ row = gtk_list_box_get_row_at_index (box, 0);
end_y = ROW_PRIV (row)->y;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]