After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 770703 - Fix crash when using page-down on GtkListBox
Fix crash when using page-down on GtkListBox
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-09-01 11:42 UTC by Joaquim Rocha
Modified: 2017-12-16 15:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
listbox: Avoid crashing on page down if the list has few rows (1.21 KB, patch)
2016-09-01 11:42 UTC, Joaquim Rocha
committed Details | Review
listbox: Select the last row on page down when there are few rows (2.31 KB, patch)
2016-09-01 11:42 UTC, Joaquim Rocha
committed Details | Review

Description Joaquim Rocha 2016-09-01 11:42:32 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.
Comment 1 Joaquim Rocha 2016-09-01 11:42:36 UTC
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.
Comment 2 Joaquim Rocha 2016-09-01 11:42:42 UTC
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.
Comment 3 Matthias Clasen 2016-09-02 22:45:51 UTC
Review of attachment 334599 [details] [review]:

sure
Comment 4 Matthias Clasen 2016-09-02 22:48:13 UTC
Review of attachment 334600 [details] [review]:

ok