Fix crash when calling the planner twice in a row

Turns out that the fix in commit f7119bdccf ("Planner: make sure no old
handles are around when entering Add/Plan") was incorrect. We ONLY want to
remove the existing handlers when we re-plan a dive, NOT when we call add
or plan.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-08-19 21:54:18 -05:00
parent fc96daf93f
commit 642ad1e0fe
3 changed files with 2 additions and 3 deletions

View file

@ -468,6 +468,7 @@ void MainWindow::on_actionReplanDive_triggered()
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
ui.newProfile->setPlanState();
ui.newProfile->clearHandlers();
ui.infoPane->setCurrentIndex(PLANNERWIDGET);
DivePlannerPointsModel::instance()->loadFromDive(current_dive);
reset_cylinders(&displayed_dive, true);

View file

@ -870,7 +870,6 @@ void ProfileWidget2::setAddState()
return;
setProfileState();
clearHandlers();
mouseFollowerHorizontal->setVisible(true);
mouseFollowerVertical->setVisible(true);
mouseFollowerHorizontal->setLine(timeAxis->line());
@ -904,7 +903,6 @@ void ProfileWidget2::setPlanState()
return;
setProfileState();
clearHandlers();
mouseFollowerHorizontal->setVisible(true);
mouseFollowerVertical->setVisible(true);
mouseFollowerHorizontal->setLine(timeAxis->line());

View file

@ -78,6 +78,7 @@ public:
bool isAddOrPlanner();
double getFontPrintScale();
void setFontPrintScale(double scale);
void clearHandlers();
State currentState;
public
@ -175,7 +176,6 @@ private:
QList<DivePictureItem*> pictures;
void repositionDiveHandlers();
int fixHandlerIndex(DiveHandler *activeHandler);
void clearHandlers();
friend class DiveHandler;
QHash<Qt::Key, QAction *> actionsForKeys;
bool shouldCalculateMaxTime;