Fix emulator freeze due to infinite loop

When probing items in the PointerSet, current implementation
gets stuck in an infinite loop, sometimes. This commit breaks
the loop when it detects that each item has already been visited.

Change-Id: Ie9b00ca39395f2c8555069ff8c1048ea381bfe33
Merge "Fix emulator freeze due to infinite loop"