Skip to content
Verified Commit 38662957 authored by snooxx 💤's avatar snooxx 💤
Browse files

KFilePlacesView: Fix crash when dragging over topmost section header

b5de820a fixed incorrect highlighting of the section header label
during drag operations over the first place of a section in clients
setting `m_dropOnPlace`, e.g. Dolphin. This was effective for all except
the topmost section header, where it would cause a crash (independent of
the state of `m_dropOnPlace`).

In `KFilePlacesViewDelegate::previousVisibleIndex` access to `model`
fails, because the `index` determined via `indexAt` of `m_dropRect` in
`KFilePlacesView::paintEvent` is invalid when dragging towards the
topmost section header label. This is because `m_dropRect.topLeft()` can
extend above the entry's `visualRect`, i.e. it covers the places items
below as well as above the separator, of which the latter does not exist
for the first entry.

By remembering the index belonging to `m_dropRect` in `m_dropIndex`
instead of reconstructing it, we can guarantee it to be valid.

BUG: 450813
BUG: 450966

Test Plan:

No more crash when dragging places or folders over topmost section
header label in places view in `kdialog --getsaveurl` as well as
`dolphin`. Other functionality related to dragging places around
(including existing bugs) is unaffected and the behavior of the original
fix remains.
parent d6c411e3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment