From 3abb82bfd5fe3a80244974186b4d6fbcd54a38a0 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 3 Sep 2022 23:06:01 +0200 Subject: [PATCH] map: don't explicitly reload the map from the mainwindow The map listens to the reset signal by itself. This avoids double reload of the map on open/close. Signed-off-by: Berthold Stoeger --- desktop-widgets/mainwindow.cpp | 6 ------ desktop-widgets/mapwidget.cpp | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 1c72aa1d4..3dc99dab2 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -200,9 +200,6 @@ MainWindow::MainWindow() : initialUiSetup(); readSettings(); diveList->setFocus(); -#ifdef MAP_SUPPORT - MapWidget::instance()->reload(); -#endif diveList->expand(diveList->model()->index(0, 0)); diveList->scrollTo(diveList->model()->index(0, 0), QAbstractItemView::PositionAtCenter); #ifdef NO_USERMANUAL @@ -507,9 +504,6 @@ void MainWindow::closeCurrentFile() clear_dive_file_data(); // this clears all the core data structures and resets the models setCurrentFile(nullptr); diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder); -#ifdef MAP_SUPPORT - MapWidget::instance()->reload(); -#endif if (!existing_filename) setTitle(); disableShortcuts(); diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp index a4ca93fd9..5ededbf2b 100644 --- a/desktop-widgets/mapwidget.cpp +++ b/desktop-widgets/mapwidget.cpp @@ -120,7 +120,7 @@ void MapWidget::divesChanged(const QVector &, DiveField field) // Sadly, for reasons out of our control, we can't use a normal singleton for the // map widget: In a standard singleton, the object is freed after main() exits. // However, if there is an animation running (map zooming), the thread is -// terminated, when the QApplication object is destroyed, which is before main() +// terminated when the QApplication object is destroyed, which is before main() // exits. The thread has a QQmlAnimationTimer that is freed. However, the map widget // then tries to free the object itself, leading to a crash. Clearly, a bug in // the QML MapWidget / QtQuick ecosystem.