ctf: Fix CtfIterator current event and location after seek
authorPatrick Tasse <patrick.tasse@gmail.com>
Fri, 5 Jun 2015 17:24:06 +0000 (13:24 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Mon, 8 Jun 2015 19:52:11 +0000 (15:52 -0400)
If an iterator has equal current and previous location (like it does
after the current event has been read once), the seek will not update
the current event even if it does not match the seek location. Then the
current event and current location of the iterator can return arbitrary
values that do not correspond with the seek location.

This can happen if the iterator instance is recycled for a different
context, which only happens when the iterator manager is full due to 100
concurrent contexts for the same trace, which probably can only happen
if there is a context leak, as the iterator is removed from the iterator
manager when it is disposed.

Change-Id: Ifd67b2c866955f424e11172b8e6fc27a35ad676a
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/49554
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/internal/tmf/ctf/core/trace/iterator/CtfIterator.java

index 7e3e213a59a4cb12de0f53182da9a1267546421d..42c543397360d300b2368f8f78a9fb2c6dae2901 100644 (file)
@@ -183,6 +183,8 @@ public class CtfIterator extends CTFTraceReader
         if (fCurLocation.getLocationInfo().equals(ctfLocationData)) {
             return super.hasMoreEvents();
         }
+        /* Update location to make sure the current event is updated */
+        fCurLocation = new CtfLocation(ctfLocationData);
 
         /* Adjust the timestamp depending on the trace's offset */
         long currTimestamp = ctfLocationData.getTimestamp();
This page took 0.026987 seconds and 5 git commands to generate.