OSDN Git Service

fd_utils: Fix broken usage of iterators.
authorNarayan Kamath <narayan@google.com>
Wed, 7 Sep 2016 12:14:40 +0000 (13:14 +0100)
committerNarayan Kamath <narayan@google.com>
Wed, 7 Sep 2016 12:14:40 +0000 (13:14 +0100)
commit0b76d6a28e6978151bf245a775329cdae5e574d5
treef1e588eb81e3280ee7c78da5ad7c1445ed7ed337
parentcefc0374eb4c0775d684ba5f650eeb1b95ee6d55
fd_utils: Fix broken usage of iterators.

There were two separate issues here :
- RestatInternal was using an iterator after a call to erase(). This
  will not work because it will be invalidated.
- The "standard" for loop idiom for iterating over a map while making
  structural changes to it is broken. Switch to a while loop and treat
  cases where elements are erased differently from cases where they
  aren't.

bug: 31092930
bug: 30963384
Change-Id: I261d59239558230dd8cdd1d1cb5b9e2448a4c23f
core/jni/fd_utils-inl.h