Tmf: Fix a bug in CFV and Xml time graph views where entries have no parent
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.analysis.xml.ui / src / org / eclipse / tracecompass / tmf / analysis / xml / ui / views / timegraph / XmlTimeGraphView.java
index 0a7938ff3c20870b61f5c957a1dd5f0f4a362dba..2b99035d65b4935d4dc32344af6a4037a79af98f 100644 (file)
@@ -449,9 +449,17 @@ public class XmlTimeGraphView extends AbstractTimeGraphView {
             boolean root = true;
             if (!entry.getParentId().isEmpty()) {
                 XmlEntry parent = entryMap.get(entry.getParentId());
+                /*
+                 * Associate the parent entry only if their time overlap. A
+                 * child entry may start before its parent, for example at the
+                 * beginning of the trace if a parent has not yet appeared in
+                 * the state system. We just want to make sure that the entry
+                 * didn't start after the parent ended or ended before the
+                 * parent started.
+                 */
                 if (parent != null &&
-                        entry.getStartTime() >= parent.getStartTime() &&
-                        entry.getStartTime() <= parent.getEndTime()) {
+                        !(entry.getStartTime() > parent.getEndTime() ||
+                        entry.getEndTime() < parent.getStartTime())) {
                     parent.addChild(entry);
                     root = false;
                 }
This page took 0.025575 seconds and 5 git commands to generate.