Crash when folding/unfolding side pane tree view

Version information

4.21.5+282+g263d6695b on arch linux

Steps to reproduce

I wasn't really able to figure out the exact steps to reliably reproduce the bug, but this is how I was able to reproduce it most often:

  1. Expand the tree view to a sufficiently large directory structure (in my case, a library at the root of a mountable volume)
  2. Select one of the leaf directories
  3. Collapse and then expand the tree view to the root by clicking the arrow next to the mountable volume

Backtrace

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f2fc10254e3 in node_get_pos (node=0x55740d90d460) at ../glib/glib/gsequence.c:1707
1707	      if (NODE_RIGHT_CHILD (node))
[Current thread is 1 (Thread 0x7f2fbe8f7f80 (LWP 906))]
(gdb) bt
#0  0x00007f2fc10254e3 in node_get_pos (node=0x55740d90d460) at ../glib/glib/gsequence.c:1707
#1  0x00007f2fc102718e in g_sequence_iter_get_position (iter=<optimized out>) at ../glib/glib/gsequence.c:1399
#2  0x00007f2fc0b14a3a in gtk_tree_model_filter_get_path (model=<optimized out>, iter=<optimized out>) at ../gtk/gtk/gtktreemodelfilter.c:3124
#3  0x00007f2fc0b204f9 in gtk_tree_model_filter_row_deleted (c_model=<optimized out>, c_path=0x55740d52a2c0, data=0x55740d8e8b40) at ../gtk/gtk/gtktreemodelfilter.c:2679
#8  0x00007f2fc1142234 in <emit signal 'row-deleted' on instance ???> (instance=instance@entry=0x55740d803860, signal_id=<optimized out>, detail=detail@entry=0) at ../glib/gobject/gsignal.c:3624
    #4  0x00007f2fc111fbbc in g_closure_invoke (closure=0x7f2fac014b40, return_value=0x0, n_param_values=2, param_values=0x7fff75f216b0, invocation_hint=0x7fff75f21600) at ../glib/gobject/gclosure.c:916
    #5  0x00007f2fc113fcfb in signal_emit_unlocked_R
    (node=node@entry=0x7fff75f217f0, detail=detail@entry=0, instance=instance@entry=0x55740d803860, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fff75f216b0)
    at ../glib/gobject/gsignal.c:3929
    #6  0x00007f2fc1141ed4 in signal_emit_valist_unlocked (instance=instance@entry=0x55740d803860, signal_id=signal_id@entry=312, detail=detail@entry=0, var_args=var_args@entry=0x7fff75f21950)
    at ../glib/gobject/gsignal.c:3561
    #7  0x00007f2fc1142179 in g_signal_emit_valist (instance=0x55740d803860, signal_id=312, detail=0, var_args=var_args@entry=0x7fff75f21950) at ../glib/gobject/gsignal.c:3304
#9  0x00007f2fc0b18488 in gtk_tree_model_row_deleted (tree_model=0x55740d803860, path=0x55740d52a2c0) at ../gtk/gtk/gtktreemodel.c:1914
#10 0x00005573f7f2a25a in thunar_tree_model_node_traverse_remove (node=0x55740dcf43c0, user_data=0x55740d803860) at ../thunar/thunar-tree-model.c:1617
#11 0x00007f2fc100e8f3 in g_node_traverse_post_order
    (node=0x55740dcf43c0, flags=flags@entry=G_TRAVERSE_ALL, func=func@entry=0x5573f7f2a219 <thunar_tree_model_node_traverse_remove>, data=data@entry=0x55740d803860) at ../glib/glib/gnode.c:582
#12 0x00007f2fc1016de9 in g_node_traverse
    (root=<optimized out>, order=order@entry=G_POST_ORDER, flags=flags@entry=G_TRAVERSE_ALL, depth=depth@entry=-1, func=func@entry=0x5573f7f2a219 <thunar_tree_model_node_traverse_remove>, data=data@entry=0x55740d803860) at ../glib/glib/gnode.c:889
#13 0x00005573f7f2a5b9 in thunar_tree_model_node_traverse_cleanup (node=0x55740dc54330, user_data=0x55740d803860) at ../thunar/thunar-tree-model.c:1542
#14 0x00007f2fc100e7a8 in g_node_traverse_pre_order
    (node=0x55740dc54330, flags=flags@entry=G_TRAVERSE_ALL, func=func@entry=0x5573f7f2a548 <thunar_tree_model_node_traverse_cleanup>, data=data@entry=0x55740d803860) at ../glib/glib/gnode.c:497
#15 0x00007f2fc100e77b in g_node_traverse_pre_order
    (node=<optimized out>, flags=flags@entry=G_TRAVERSE_ALL, func=func@entry=0x5573f7f2a548 <thunar_tree_model_node_traverse_cleanup>, data=data@entry=0x55740d803860) at ../glib/glib/gnode.c:507
#16 0x00007f2fc100e77b in g_node_traverse_pre_order
    (node=<optimized out>, flags=flags@entry=G_TRAVERSE_ALL, func=func@entry=0x5573f7f2a548 <thunar_tree_model_node_traverse_cleanup>, data=data@entry=0x55740d803860) at ../glib/glib/gnode.c:507
#17 0x00007f2fc100e77b in g_node_traverse_pre_order (node=<optimized out>, flags=flags@entry=G_TRAVERSE_ALL, func=func@entry=0x5573f7f2a548 <thunar_tree_model_node_traverse_cleanup>, data=0x55740d803860, 
    data@entry=<error reading variable: value has been optimized out>) at ../glib/glib/gnode.c:507
#18 0x00007f2fc1016db5 in g_node_traverse
    (root=<optimized out>, order=order@entry=G_PRE_ORDER, flags=flags@entry=G_TRAVERSE_ALL, depth=depth@entry=-1, func=func@entry=0x5573f7f2a548 <thunar_tree_model_node_traverse_cleanup>, data=<error reading variable: value has been optimized out>) at ../glib/glib/gnode.c:883
#19 0x00005573f7f2a18f in thunar_tree_model_cleanup_idle (user_data=<error reading variable: value has been optimized out>) at ../thunar/thunar-tree-model.c:934
#20 0x00007f2fc100cf04 in g_timeout_dispatch (source=0x55740db3b410, callback=<optimized out>, user_data=<optimized out>) at ../glib/glib/gmain.c:5324
#21 g_timeout_dispatch (source=0x55740db3b410, callback=<optimized out>, user_data=<optimized out>) at ../glib/glib/gmain.c:5302
#22 0x00007f2fc100bc16 in g_main_dispatch (context=0x55740d28d9c0) at ../glib/glib/gmain.c:3591
#23 0x00007f2fc100de77 in g_main_context_dispatch_unlocked (context=0x55740d28d9c0) at ../glib/glib/gmain.c:4451
#24 g_main_context_iterate_unlocked (context=context@entry=0x55740d28d9c0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4516
#25 0x00007f2fc100dff5 in g_main_context_iteration (context=context@entry=0x55740d28d9c0, may_block=may_block@entry=1) at ../glib/glib/gmain.c:4582
#26 0x00007f2fc125a386 in g_application_run (application=application@entry=0x55740d29f4b0, argc=argc@entry=2, argv=argv@entry=0x7fff75f21f28) at ../glib/gio/gapplication.c:2743
#27 0x00005573f7eb858f in main (argc=2, argv=0x7fff75f21f28) at ../thunar/main.c:80