D26226: [KListOpenFilesJob] Use QString::splitRef()

David Faure noreply at phabricator.kde.org
Thu Dec 26 08:51:21 GMT 2019


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

INLINE COMMENTS

> klistopenfilesjob_unix.cpp:71
> +        // remove duplicates
> +        std::unique(pidList.begin(), pidList.end());
>          for (const auto& pidStr : qAsConst(pidList)) {

This does not work the way you think it does.

"A call to std::unique is typically followed by a call to a container's erase method, which erases the unspecified values and reduces the physical size of the container to match its new logical size."

Also, note that unlike removeDuplicates(), std::unique requires the container to be sorted (or at least the duplicates to be consecutive). But AFAICS the output of lsof is already sorted? In fact in all my tests I don't manage to see it output duplicates... Are you sure this can happen?

REPOSITORY
  R244 KCoreAddons

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

To: ahmadsamir, #frameworks, mpyne, dfaure, apol
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191226/708b537b/attachment.html>


More information about the Kde-frameworks-devel mailing list