summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorBernd Hufmann2012-11-29 11:40:27 (EST)
committer Bernd Hufmann2012-11-30 09:54:54 (EST)
commit75128abc752815183062693e4d595fc480c64e0c (patch)
tree9e7053d2e0961330fa2772c7146e17e04bdc21da
parent48212066c25ab1556763d85708cbd7e85bf1dcac (diff)
downloadorg.eclipse.linuxtools-75128abc752815183062693e4d595fc480c64e0c.zip
org.eclipse.linuxtools-75128abc752815183062693e4d595fc480c64e0c.tar.gz
org.eclipse.linuxtools-75128abc752815183062693e4d595fc480c64e0c.tar.bz2
Handle concurrent seek and dispose in CtfTmfTrace properlyrefs/changes/38/8938/2
Change-Id: I097f7f062e5c301fe9f00bab52f709b7afebb376 Reviewed-on: https://git.eclipse.org/r/8938 Tested-by: Hudson CI Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
index d8a35d8..f1b6427 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
@@ -166,9 +166,14 @@ public class CtfTmfTrace extends TmfTrace implements ITmfEventParser {
* @return ITmfContext
*/
@Override
- public ITmfContext seekEvent(final ITmfLocation location) {
+ public synchronized ITmfContext seekEvent(final ITmfLocation location) {
CtfLocation currentLocation = (CtfLocation) location;
CtfTmfLightweightContext context = new CtfTmfLightweightContext(this);
+ if (fTrace == null) {
+ context.setLocation(null);
+ context.setRank(ITmfContext.UNKNOWN_RANK);
+ return context;
+ }
/*
* The rank is set to 0 if the iterator seeks the beginning. If not, it
* will be set to UNKNOWN_RANK, since CTF traces don't support seeking
@@ -196,8 +201,13 @@ public class CtfTmfTrace extends TmfTrace implements ITmfEventParser {
@Override
- public ITmfContext seekEvent(double ratio) {
+ public synchronized ITmfContext seekEvent(double ratio) {
CtfTmfLightweightContext context = new CtfTmfLightweightContext(this);
+ if (fTrace == null) {
+ context.setLocation(null);
+ context.setRank(ITmfContext.UNKNOWN_RANK);
+ return context;
+ }
final long end = this.getEndTime().getValue();
final long start = this.getStartTime().getValue();
final long diff = end - start;