Fix SIGSEGV after dive computer download
Linus Torvalds
torvalds at linux-foundation.org
Tue Sep 17 14:19:20 UTC 2013
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 at linux-foundation.org>
---
This just mindlessly replaces the incomplete widget reload in
MainWindow::refreshDisplay() with what everybody else seems to do.
We should probably do a helper function that does this so that we
don't need to repeat the magic incantation of "reload everything" in
multiple places.
On Tue, Sep 17, 2013 at 10:53 AM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> Anyway, all the other callers of process_dives() seem to do a big
> reload afterwards, and the dive computerdownload is missing code like
> this:
>
> ui->InfoWidget->reload();
> ui->globe->reload();
> ui->ListWidget->reload(DiveTripModel::TREE);
> ui->ListWidget->setFocus();
> WSInfoModel *wsim = WSInfoModel::instance();
> wsim->updateInfo();
>
> which is probably why that old stale pointer then stays around, and
> the ^S ^Q just triggers the final repainting or something like that...
>
> Linus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 805 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130917/601690ac/attachment.obj>
More information about the subsurface
mailing list