D27965: [KPasswdServer] replace foreach with range/index-based for

Ahmad Samir noreply at phabricator.kde.org
Wed Mar 11 09:42:49 GMT 2020


ahmadsamir added a comment.


  In D27965#625526 <https://phabricator.kde.org/D27965#625526>, @apol wrote:
  
  > Having the iterated value change under the hood will eventually break. I'd suggest preferring QList::erase to QList::removeOne.
  
  
  Actually, the code also uses 'delete current', now if there's another instance of that AuthInfoContainer* in authList, on a next iteration accessing the pointer "current" would be invalid as the object it had pointed to has been already delete'ed... I think removeAll() would be a better fit; WDYT?

REPOSITORY
  R241 KIO

BRANCH
  l-kpasswdserver (branched from master)

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

To: ahmadsamir, #frameworks, dfaure, meven
Cc: apol, kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200311/0eca8b8b/attachment.html>


More information about the Kde-frameworks-devel mailing list