Fix SIGSEGV after dive computer download

Danilo Cesar danilo.eu at gmail.com
Tue Sep 17 14:51:11 UTC 2013


moving process_dives to the main thread.

git at github.com:danilocesar/subsurface.git racefix

Danilo

On Tue, Sep 17, 2013 at 6:19 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
> 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
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
>



-- 
Danilo Cesar Lemes de Paula
http://www.danilocesar.com


More information about the subsurface mailing list