Skip to content
Commit e306c63d authored by Marco Martin's avatar Marco Martin
Browse files

FolderView Positioner: fix rows insert and remove

The positioner "proxy" model had problems both in rows insertion and
removal.

when an icon is dropped in an empty desktop area as the new "last"
position, the positioner model creates new empty items for the GridView
until it reaches the cell of the drop position.

This broke because of connection slot invocation order: the connection
to QAbstractItemModel::rowsInserted in FolderModel constructor was
executed before the connection in positioner.
In turn that connection emitted move, which invoked move on Positioner,
which at this point thinks its still in the first rows insertion
transaction, because its slot has not been executed yet,
and m_beginInsertRowsCalled is still true, so there won't be a "correct"
new beginInsertRows called.
Make it a Queued connection to push it back.

In the same way, when dragging from a "last" position, the Positioner model
will remove all the trailing empty items. But it modified m_proxyToSource
(from which rowCount() depends) before calling beginRemoveRows, sending
the model into an inconsitent state and causing an assert. Make sure
that m_proxyToSource is touched only after beginRemoveRows.

BUG:481254
BUG:466337
parent 257e59cd
Pipeline #617003 passed with stage
in 9 minutes and 18 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment