! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Thunar crashed when arrow key pressing immediately after directory change
Status:
RESOLVED: FIXED

Comments

Description Dmitry 2016-12-16 09:16:44 CET
Created attachment 6927 
Fixing patch for exo version 0.10.7

=== STEPS TO REPRODUCE ===

1) Go to keyboard settings and choose fastest possible key press repeat speed.

2) Open Thunar in any directory that (and a few parents of that, too) contains more than one element.

3) Select View->View as Icons.

4) Press the "right arrow" key, wait a couple of seconds (at least key press repeat delay) and start clicking "Open the parent folder" button (keeping "right arrow" key holding).

After a few clicks segfault will occur.

=== CAUSE ===

ExoIconView widget may be in inconsistent state where item->n_cells != icon_view->priv->n_cells for some item. In such cases layout_callback with priority G_PRIORITY_DEFAULT_IDLE is scheduled which recalculate item sizes and reallocate memory for item->{box,after,before}, thus making icon_view consistent again.

But X events are scheduled with higher priority G_PRIORITY_DEFAULT, so key press handling may occur when icon_view is still inconsistent. The latter may end up in calling exo_icon_view_scroll_to_item, and, finally, exo_icon_view_get_item_needed_size, which iterates over icon_view->priv->cell_list and indexes item->box by info->position without checking for item->n_cells (which may be less that icon_view->priv->n_cells). This leads to crash.

=== REMEDY ===

Note that another function, exo_icon_view_scroll_to_path, checks for this inconsistency (indicated by icon_view->priv->layout_idle_id != 0 condition) and delays scrolling in this case. Otherwise it calls aforementioned exo_icon_view_scroll_to_item.

The patch (see attachment) fixes the bug (tested against exo-0.10.7).

(It's probably better to pass extra GtkTreePath* parameter (or just its the only index) to not search for index of item in icon_view->priv->items.)
Comment 1 Git Bot editbugs 2017-06-16 04:48:57 CEST
Dmitry referenced this bugreport in commit 90f08e1f4aac5201372c8887c020700ec33de015

FIX: Thunar crashed when arrow key pressing immediately after directory change (Bug #13238)

https://git.xfce.org/xfce/exo/commit?id=90f08e1f4aac5201372c8887c020700ec33de015
Comment 2 Sean Davis editbugs 2017-06-16 04:50:48 CEST
Thanks for the thorough report, explanation, and patch! I've tested this and applied it with the above commit.

Bug #13238

Reported by:
Dmitry
Reported on: 2016-12-16
Last modified on: 2017-06-16

People

Assignee:
Sean Davis
CC List:
2 users

Version

Version:
unspecified

Attachments

Additional information