Fix AllPlot delete ride crash.

Fixes #431.
This commit is contained in:
Mark Liversedge
2011-08-27 17:19:54 +01:00
parent fa08db6a3a
commit e1ee78ac7c
3 changed files with 20 additions and 1 deletions

View File

@@ -676,7 +676,10 @@ AllPlot::setXTitle()
void
AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx)
{
if (plot == NULL) return;
if (plot == NULL) {
rideItem = NULL;
return;
}
referencePlot = plot;

View File

@@ -353,6 +353,7 @@ AllPlotWindow::AllPlotWindow(MainWindow *mainWindow) :
connect(mainWindow, SIGNAL(intervalSelected()), this, SLOT(intervalSelected()));
connect(mainWindow, SIGNAL(configChanged()), allPlot, SLOT(configChanged()));
connect(mainWindow, SIGNAL(configChanged()), this, SLOT(configChanged()));
connect(mainWindow, SIGNAL(rideDeleted(RideItem*)), this, SLOT(rideDeleted(RideItem*)));
}
void
@@ -551,6 +552,20 @@ AllPlotWindow::rideSelected()
stale = false;
}
void
AllPlotWindow::rideDeleted(RideItem *ride)
{
if (ride == myRideItem) {
// we have nothing to show
setProperty("ride", QVariant::fromValue<RideItem*>(NULL));
// notify all the plots, because when zones are redrawn
// they will try and reference AllPlot::rideItem
setAllPlotWidgets(NULL);
fullPlot->setDataFromRide(NULL);
}
}
void
AllPlotWindow::zonesChanged()
{

View File

@@ -87,6 +87,7 @@ class AllPlotWindow : public GcWindow
// trap GC signals
void rideSelected();
void rideDeleted(RideItem *ride);
void intervalSelected();
void zonesChanged();
void intervalsChanged();