Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Tasse2013-12-10 12:06:32 -0500
committerBernd Hufmann2013-12-19 07:17:13 -0500
commit8a3617dad4f549e0094130a10511b434342b1d68 (patch)
treeb4f41e440e47b0ce1dc823e64eaa14d28f5a69da
parent90625b1439acd59fb9233a58827a38a3cd085cf6 (diff)
downloadorg.eclipse.linuxtools-8a3617dad4f549e0094130a10511b434342b1d68.tar.gz
org.eclipse.linuxtools-8a3617dad4f549e0094130a10511b434342b1d68.tar.xz
org.eclipse.linuxtools-8a3617dad4f549e0094130a10511b434342b1d68.zip
tmf: Fix incorrect histogram state when concurrently cleared during drag
- Reset the offset when drag zoom interrupted by clear - Update selection when drag selection interrupted by clear - Fix overflow in min and max offset calculation Change-Id: I6eea70d713d4b46e75d254b9374631623c023600 Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com> Reviewed-on: https://git.eclipse.org/r/19605 Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com> IP-Clean: Bernd Hufmann <bernd.hufmann@ericsson.com> Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com> Tested-by: Hudson CI
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java3
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/TimeRangeHistogram.java7
2 files changed, 8 insertions, 2 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
index 33e5136b38..d47a9f80e6 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
@@ -417,6 +417,9 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
*/
public void clear() {
fDataModel.clear();
+ if (fDragState == DRAG_SELECTION) {
+ updateSelectionTime();
+ }
fDragState = DRAG_NONE;
fDragButton = 0;
synchronized (fDataModel) {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/TimeRangeHistogram.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/TimeRangeHistogram.java
index 103dacf749..b9876f72cd 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/TimeRangeHistogram.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/TimeRangeHistogram.java
@@ -70,6 +70,7 @@ public class TimeRangeHistogram extends Histogram {
fRangeDuration = 0L;
fFullRangeStartTime = 0L;
fFullRangeEndTime = 0L;
+ setOffset(0);
if (fZoom != null) {
fZoom.setFullRange(0L, 0L);
fZoom.setNewRange(0L, 0L);
@@ -119,8 +120,10 @@ public class TimeRangeHistogram extends Histogram {
fDragState = DRAG_RANGE;
fDragButton = event.button;
fStartPosition = event.x;
- fMaxOffset = (int) ((fRangeStartTime - fFullRangeStartTime) / fScaledData.fBucketDuration);
- fMinOffset = (int) ((fRangeStartTime + fRangeDuration - fFullRangeEndTime) / fScaledData.fBucketDuration);
+ long maxOffset = (fRangeStartTime - fFullRangeStartTime) / fScaledData.fBucketDuration;
+ long minOffset = (fRangeStartTime + fRangeDuration - fFullRangeEndTime) / fScaledData.fBucketDuration;
+ fMaxOffset = (int) Math.max(Integer.MIN_VALUE, Math.min(Integer.MAX_VALUE, maxOffset));
+ fMinOffset = (int) Math.max(Integer.MIN_VALUE, Math.min(Integer.MAX_VALUE, minOffset));
return;
} else if (event.button == 3) {
fDragState = DRAG_ZOOM;

Back to the top