D18182: Fix new file creation leading to dupe items on a fresh view

David Edmundson noreply at phabricator.kde.org
Thu Jan 24 12:01:30 GMT 2019


davidedmundson added inline comments.

INLINE COMMENTS

> foldermodel.cpp:170
>      connect(this, &QAbstractItemModel::rowsInserted,
>              this, [this](const QModelIndex &parent, int first, int last) {
>          for (int i = first; i <= last; ++i) {

I'm a bit worried about queuing something with indexes. Indexes are only valid at that exact moment.

If the source model does the following:
beginInsertRows(AA);
endInsertRows()
beginInsertRows(BB);
endInsertRows()
then exits back to the event loop

When you process the delayed connection for the first insertion the old first/last could be pointing anywhere.

We could maybe get round this by converting to QPeristentModelIndexes immediately, then queue up the operation that uses them.

REPOSITORY
  R119 Plasma Desktop

REVISION DETAIL
  https://phabricator.kde.org/D18182

To: hein, #plasma, McPain
Cc: davidedmundson, fvogt, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190124/b496b10b/attachment.html>


More information about the Plasma-devel mailing list