Fix Crash in ErgFilePlot TimeScaleDraw

The TimeScaleDraw declaration and definition in
ErgPlot.h clashes (silently) with the definition
in PerfPlot.h.

This caused a SEGV at runtime, but only with some
build tools (but notably Xcode on Lion). Not at
all sure how this has not arisen before.

ErgFilePlot now declares as HourTimeScaleDraw to
avoid the clash.
This commit is contained in:
Mark Liversedge
2011-11-20 14:07:47 +00:00
parent 145433dee6
commit 466b7c1a49
2 changed files with 6 additions and 6 deletions

View File

@@ -85,7 +85,7 @@ ErgFilePlot::ErgFilePlot(MainWindow *main) : main(main)
enableAxis(xBottom, true);
distdraw = new DistScaleDraw;
distdraw->setTickLength(QwtScaleDiv::MajorTick, 3);
timedraw = new TimeScaleDraw;
timedraw = new HourTimeScaleDraw;
timedraw->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisMaxMinor(xBottom, 0);
setAxisScaleDraw(QwtPlot::xBottom, timedraw);
@@ -286,7 +286,7 @@ ErgFilePlot::setData(ErgFile *ergfile)
// only allocate a new one if its not the current (they get freed by Qwt)
if (axisScaleDraw(xBottom) != timedraw)
setAxisScaleDraw(QwtPlot::xBottom, (timedraw=new TimeScaleDraw()));
setAxisScaleDraw(QwtPlot::xBottom, (timedraw=new HourTimeScaleDraw()));
}
}
@@ -307,7 +307,7 @@ ErgFilePlot::setData(ErgFile *ergfile)
// set the axis so we default to an hour workout
if (axisScaleDraw(xBottom) != timedraw)
setAxisScaleDraw(QwtPlot::xBottom, (timedraw=new TimeScaleDraw()));
setAxisScaleDraw(QwtPlot::xBottom, (timedraw=new HourTimeScaleDraw()));
setAxisScale(xBottom, (double)0, 1000 * 60 * 60, 15*60*1000);
}
}