[gtk+/gtk-3-20] listbox: Avoid crashing on page down if the list has few rows
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-20] listbox: Avoid crashing on page down if the list has few rows
- Date: Tue, 6 Sep 2016 12:18:17 +0000 (UTC)
commit eb2a73704b36380c23ab8652f157e9b753c2146f
Author: Joaquim Rocha <jrocha endlessm com>
Date: Thu Sep 1 13:23:14 2016 +0200
listbox: Avoid crashing on page down if the list has few rows
The code always assumed that getting a row at a certain 'y' was
possible but if the list box has more empty space than rows then a
valid row may not be retrieved.
https://bugzilla.gnome.org/show_bug.cgi?id=770703
gtk/gtklistbox.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 2c21c6d..bcccbcf 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -3041,10 +3041,11 @@ gtk_list_box_move_cursor (GtkListBox *box,
height = gtk_widget_get_allocated_height (GTK_WIDGET (box));
end_y = CLAMP (start_y + page_size * count, 0, height - 1);
row = gtk_list_box_get_row_at_y (box, end_y);
- iter = ROW_PRIV (row)->iter;
if (row == priv->cursor_row)
{
+ iter = ROW_PRIV (row)->iter;
+
/* Move at least one row. This is important when the cursor_row's height is
* greater than page_size */
if (count < 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]