dfaure added a comment.

  In D27965#625676 <https://phabricator.kde.org/D27965#625676>, @ahmadsamir 
wrote:
  
  > 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?
  
  
  authList does not contain duplicates. Otherwise the current code would 
already have the problem you're mentioning.
  So I see no reason to protect against that case.
  erase sounds much safer than removeOne which has unclear consequences on the 
iterators.

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

Reply via email to