summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-09-17 17:19:20 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-17 17:21:41 -0400
commitf8e33e171a830c54a3df96939eed01efc2ca2c58 (patch)
tree3134d31f1c6896dd2b906853c603f52688b32e9c /qt-ui/mainwindow.cpp
parent1d76ccb8b9bbcb6e2c98e4faca31ddd5d02050ce (diff)
downloadsubsurface-f8e33e171a830c54a3df96939eed01efc2ca2c58.tar.gz
Fix SIGSEGV after dive computer download
This fixes a crash in the current Qt subsurface code that can happen after downloading dives from a dive computer, and the new dives merge with old dives, causing the old dives to be re-allocated into the merged one. In that case, the list widgets don't get fully updated, and contain stale pointers to old dives that no longer exists. Doing anything that refreshes the display will hide this problem, and you do need to have multiple dive computers on the same dive to trigger it in the first place, so it's reasonably hard to hit, but very annoying when you do. This patch just makes us reload all the dive UI tables, which may be overkill. It also doesn't actually fix the fact that we seem to do "process_dives()" within the context of the downloader thread, which looks like a possible source of races. The "process_dives()" should also be moved to the main thread, but needs the preferDownloaded() information that is part of the download window, so it doesn't fit here. Somebody else (Tomaz?) will hopefully fix that part. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 740849033..44cc9e60b 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -65,9 +65,12 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()), helpView(0)
// this gets called after we download dives from a divecomputer
void MainWindow::refreshDisplay()
{
- if (selected_dive == -1)
- current_dive_changed(dive_table.nr - 1);
- ui->ListWidget->reload(DiveTripModel::CURRENT, false);
+ ui->InfoWidget->reload();
+ ui->globe->reload();
+ ui->ListWidget->reload(DiveTripModel::TREE);
+ ui->ListWidget->setFocus();
+ WSInfoModel *wsim = WSInfoModel::instance();
+ wsim->updateInfo();
}
void MainWindow::current_dive_changed(int divenr)