summaryrefslogtreecommitdiffstats
path: root/profile-widget/divetooltipitem.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-11-15 20:50:44 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-16 08:29:53 -0800
commitf0a89759bf38375d32ad70ba4710a98d30a47e5d (patch)
treee49f74e6d4fad9a19c05384138edb061dcda69c1 /profile-widget/divetooltipitem.cpp
parent12c7c5ea961bcdc866dbf6ce121c428d43c3730b (diff)
downloadsubsurface-f0a89759bf38375d32ad70ba4710a98d30a47e5d.tar.gz
Profile: clear tooltip's plotInfo in ProfileWidget2::setEmptyState
The tooltip's plotInfo was not cleared when clearing the profile. With the new cylinder code, this lead to crashes, because the displayed_dive's cylinder array is now cleared. The old code would happily read stale data from the fixed-size cylinders array. Clear the plotInfo explicitly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/divetooltipitem.cpp')
-rw-r--r--profile-widget/divetooltipitem.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/profile-widget/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp
index 16be94c15..908f40070 100644
--- a/profile-widget/divetooltipitem.cpp
+++ b/profile-widget/divetooltipitem.cpp
@@ -139,7 +139,7 @@ ToolTipItem::ToolTipItem(QGraphicsItem *parent) : QGraphicsRectItem(parent),
timeAxis(0),
lastTime(-1)
{
- memset(&pInfo, 0, sizeof(pInfo));
+ clearPlotInfo();
entryToolTip.first = NULL;
entryToolTip.second = NULL;
setFlags(ItemIgnoresTransformations | ItemIsMovable | ItemClipsChildrenToShape);
@@ -223,6 +223,11 @@ void ToolTipItem::setPlotInfo(const plot_info &plot)
pInfo = plot;
}
+void ToolTipItem::clearPlotInfo()
+{
+ memset(&pInfo, 0, sizeof(pInfo));
+}
+
void ToolTipItem::setTimeAxis(DiveCartesianAxis *axis)
{
timeAxis = axis;