From 85f8f389232428a386f43c50cf633106572f11f4 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Tue, 29 Nov 2022 07:43:27 +0800 Subject: [PATCH] Cabana: fix segfault in dragging zoom (#26598) fix segfault old-commit-hash: 909a884dc5d2aaaff270e86d2707b51037c87bc4 --- tools/cabana/chartswidget.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cabana/chartswidget.cc b/tools/cabana/chartswidget.cc index 6e1f2e110c..a3faab0a20 100644 --- a/tools/cabana/chartswidget.cc +++ b/tools/cabana/chartswidget.cc @@ -398,8 +398,8 @@ void ChartView::mouseReleaseEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton && rubber && rubber->isVisible()) { rubber->hide(); QRectF rect = rubber->geometry().normalized(); - double min = chart()->mapToValue(rect.topLeft()).x(); - double max = chart()->mapToValue(rect.bottomRight()).x(); + double min = std::floor(chart()->mapToValue(rect.topLeft()).x() * 10.0) / 10.0; + double max = std::floor(chart()->mapToValue(rect.bottomRight()).x() * 10.0) / 10.0; if (rubber->width() <= 0) { // no rubber dragged, seek to mouse position can->seekTo(min);