From 642ad1e0fe292895d65765dc4ac7b5df9fe42ca8 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 19 Aug 2014 21:54:18 -0500 Subject: Fix crash when calling the planner twice in a row Turns out that the fix in commit f7119bdccfb2 ("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 --- qt-ui/mainwindow.cpp | 1 + qt-ui/profile/profilewidget2.cpp | 2 -- qt-ui/profile/profilewidget2.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index c8461aee8..17c554777 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -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); diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 7a5722082..675a1029c 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -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()); diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h index dc08be3d7..af52b41bb 100644 --- a/qt-ui/profile/profilewidget2.h +++ b/qt-ui/profile/profilewidget2.h @@ -78,6 +78,7 @@ public: bool isAddOrPlanner(); double getFontPrintScale(); void setFontPrintScale(double scale); + void clearHandlers(); State currentState; public @@ -175,7 +176,6 @@ private: QList pictures; void repositionDiveHandlers(); int fixHandlerIndex(DiveHandler *activeHandler); - void clearHandlers(); friend class DiveHandler; QHash actionsForKeys; bool shouldCalculateMaxTime; -- cgit v1.2.3-70-g09d2