summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-08-30 16:51:59 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-09-06 11:48:47 -0700
commitb39f2406c6a520f0b3743324744f3c55914adc52 (patch)
tree8cfadbb34be79cf9e75d2280b70fc1d887380f49 /desktop-widgets
parentcabe70be8079a69e159d46525fc8b283d9ec7c2a (diff)
downloadsubsurface-b39f2406c6a520f0b3743324744f3c55914adc52.tar.gz
Map: don't fully reset model on selection change
When changing the selection the MapLocationModel was reset. This lead to crashes on Qt-5.9 which are due to QML accessing data that was freed during model reset. This putative Qt bug doesn't happen on newer Qt versions. At least Qt-5.12 is known to work. Instead of fighting the bug, let's simply not reset the model but send a dataChanged() for every element of the MapLocationModel. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/mainwindow.cpp2
-rw-r--r--desktop-widgets/mapwidget.cpp7
-rw-r--r--desktop-widgets/mapwidget.h1
3 files changed, 9 insertions, 1 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 2a215b1b7..004d5823d 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -464,7 +464,7 @@ void MainWindow::selectionChanged()
configureToolbar();
enableDisableOtherDCsActions();
}
- MapWidget::instance()->reload();
+ MapWidget::instance()->selectionChanged();
}
void MainWindow::on_actionNew_triggered()
diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp
index 27c30686f..376a29998 100644
--- a/desktop-widgets/mapwidget.cpp
+++ b/desktop-widgets/mapwidget.cpp
@@ -84,6 +84,13 @@ bool MapWidget::editMode() const
return isReady && m_mapHelper->editMode();
}
+void MapWidget::selectionChanged()
+{
+ CHECK_IS_READY_RETURN_VOID();
+ m_mapHelper->selectionChanged();
+ m_mapHelper->centerOnSelectedDiveSite();
+}
+
void MapWidget::selectedDivesChanged(const QList<int> &list)
{
CHECK_IS_READY_RETURN_VOID();
diff --git a/desktop-widgets/mapwidget.h b/desktop-widgets/mapwidget.h
index bc9303166..9e05ce48f 100644
--- a/desktop-widgets/mapwidget.h
+++ b/desktop-widgets/mapwidget.h
@@ -23,6 +23,7 @@ public:
static MapWidget *instance();
void reload();
+ void selectionChanged();
bool editMode() const;
public slots: