Skip to content

Fix crashes and ghost items when using the filter bar

Ismael Asensio requested to merge work/fix_filter_rangefor into release/20.12

Instead of using a mutable iterator, loop over a const copy list of the visible items.

This fixes the latest problems with the filter bar and effectively reverts !85 (merged) but using explicit copy instead of qAsConst(see discussion there).

BUG: 428374

About the bug explicitely, the problem with using an iterator is that we're deleting items from m_visibleItems while iterating, and the iterator ending gets confused in some corner cases, with two bad effects:

  1. The iterator turns around and goes through some items twice: those indexes get duplicated in itemsToMove, causing crashes in later assertion
  2. The iterator ends before covering all of the visible items that should be removed: then we get leftover "ghost" items.
Edited by Ismael Asensio

Merge request reports