hit this crash while showing subsurface to a dive school, luckly they didn't see. :)
From a9b4a266703e032997c1b03ed2df28eeab2b9ae1 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Thu, 26 Jun 2014 15:31:01 -0300 Subject: [PATCH 6/6] Fix crash when trying to add a dive or plan when a filter is active.
The planner used the selected dive on the dive list, and when there's a filtering in action it can be in a state where there's no dive selected. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/divelistview.cpp | 6 ++++++ qt-ui/divelistview.h | 1 + qt-ui/mainwindow.cpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 78186ec..4f5bfec 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -825,3 +825,9 @@ void DiveListView::updateLastImageTimeOffset(const int offset) s.beginGroup("MainWindow"); s.setValue("LastImageTimeOffset", offset); } + +void DiveListView::endSearch() +{ + searchBox.clear(); + searchBox.hide(); +} diff --git a/qt-ui/divelistview.h b/qt-ui/divelistview.h index 320bf95..7ab409b 100644 --- a/qt-ui/divelistview.h +++ b/qt-ui/divelistview.h @@ -52,6 +52,7 @@ slots: void shiftTimes(); void loadImages(); static QString lastUsedImageDir(); + void endSearch(); signals: void currentDiveChanged(int divenr); diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 13a4413..1b87ed9 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -461,6 +461,7 @@ void MainWindow::on_actionDivePlanner_triggered() if(!plannerStateClean()) return; + ui.ListWidget->endSearch(); // put us in PLAN mode DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN); ui.newProfile->setPlanState(); @@ -491,6 +492,7 @@ void MainWindow::on_actionAddDive_triggered() if(!plannerStateClean()) return; + ui.ListWidget->endSearch(); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD); createFakeDiveForAddAndPlan(); -- 2.0.0
_______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
