mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
1d76ccb8b9
commit
f8e33e171a
1 changed files with 6 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue