Fix broken handling of instrumentation lists.

- We cannot copy before iterating, as entries might be deleted.
- We cannot remove entries in the list, as mutators could be
  currently iterating over it.

Solution in this change is to never remove list entries, but
put null when a listener is removed. When adding a listener, we
will either put it where there is a null slot, or at the end
of the list if there is no null slot.

Change-Id: Id94582fd971cd56bcb445caff64270d21987f700
2 files changed