GNOME Bugzilla – Bug 770703
Fix crash when using page-down on GtkListBox
Last modified: 2017-12-16 15:16:50 UTC
When pressing page-down on a listbox with only a few rows and more empty space is leading to a crash.
This is happening because it attempts to fetch a row under a certain 'y', which, under the scenario mentioned above may not be possible, leading to a NULL row.
The problem is easily reproducible in the gtk3-demo by editing messages.txt to leave only 3 items/rows and pressing page-down in the resulting listbox.
Besides fixing the crash, I believe that a page-down should always select the last row visible in the list when there are only a few rows.
Created attachment 334599 [details] [review]
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.
Created attachment 334600 [details] [review]
listbox: Select the last row on page down when there are few rows
When pressing page down doesn't retrieve a valid row (because the list
box has few rows), the last visible one should be selected instead.
Review of attachment 334599 [details] [review]:
Review of attachment 334600 [details] [review]: