Fix a crash on changing dives when the ruler is used.

The ruler is a weird beast - it has two child objects that access the
parent to call another function, that call the child functions.

When I updated the plot_info I didn't take that into consideration, what
happened is that when I set the parent's plot_info, the children's
plot_info are still invalid, but the update method is called anyhow.

This patch updates all plot_info's before calling anything else.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-03-07 12:08:31 -03:00 committed by Dirk Hohndel
parent 8034106219
commit 6dec4b0556
3 changed files with 18 additions and 10 deletions

View file

@ -365,7 +365,6 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
heartBeatAxis->setVisible(false);
}
timeAxis->setMaximum(maxtime);
rulerItem->setPlotInfo(pInfo);
int i, incr;
static int increments[8] = { 10, 20, 30, 60, 5 * 60, 10 * 60, 15 * 60, 30 * 60 };
/* Time markers: at most every 10 seconds, but no more than 12 markers.
@ -385,6 +384,8 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
timeAxis->updateTicks();
cylinderPressureAxis->setMinimum(pInfo.minpressure);
cylinderPressureAxis->setMaximum(pInfo.maxpressure);
rulerItem->setPlotInfo(pInfo);
meanDepth->setMeanDepth(pInfo.meandepth);
meanDepth->setLine(0, 0, timeAxis->posAtValue(d->duration.seconds), 0);
meanDepth->animateMoveTo(3, profileYAxis->posAtValue(pInfo.meandepth));