D10742: get rid of the raw KFileItem pointers in KCoreDirListerCache

David Faure noreply at phabricator.kde.org
Mon May 28 08:01:40 UTC 2018


dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> kcoredirlister.cpp:963
>      QUrl oldurl = src.adjusted(QUrl::StripTrailingSlash);
> -    KFileItem *fileitem = findByUrl(nullptr, oldurl);
> -    if (!fileitem) {
> +    // refresh the found item
> +    KFileItem fileitem = findByUrl(nullptr, oldurl, true);

Where did the old code call refresh() (which you now call inside findByUrl)? I don't see it, I only see more specific calls in more specific cases. So this looks slower and possibly incorrect (for non-local-files).

> kcoredirlister.cpp:1004
>          if (nameOnly) {
> -            fileitem->setName(dst.fileName());
> +            fileitem.setName(dst.fileName());
>          } else {

This used to modify the fileitem in dirItem->lstItems, now it's modifying a copy.
Same for all other fileitem.setFoo calls below.

Is there a call to reinsert missing?

> kcoredirlister.cpp:1843
> -                const KFileItem oldItem = *tmp;
> -                *tmp = item;
>                  foreach (KCoreDirLister *kdl, listers) {

This used to modify the item in dir->lstItems, so you need to reinsert in order to not lose the changes.

> kcoredirlister.cpp:2042
> +            KFileItem oldItem = item;
> +            item.refresh();
> +

Needs to be reinserted afterwards.

REPOSITORY
  R241 KIO

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

To: jtamate, #frameworks, dfaure
Cc: bruns, kde-frameworks-devel, mwolff, markg, michaelh, ngraham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180528/8762248a/attachment.html>


More information about the Kde-frameworks-devel mailing list