From 608209fff23417f77526bef836bb505bc05c7eff Mon Sep 17 00:00:00 2001 From: Danilo Cesar Lemes de Paula Date: Tue, 17 Sep 2013 18:36:22 -0300 Subject: [PATCH] move process_dives to the mainthread Avoids a race condition. Signed-off-by: Danilo Cesar Lemes de Paula --- qt-ui/downloadfromdivecomputer.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp index 52ef77d48..eaf8efd70 100644 --- a/qt-ui/downloadfromdivecomputer.cpp +++ b/qt-ui/downloadfromdivecomputer.cpp @@ -261,6 +261,10 @@ void DownloadFromDCWidget::onDownloadThreadFinished() updateState(DONE); else updateState(ERROR); + + // I'm not sure if we should really call process_dives even + // if there's an error or a cancelation + process_dives(TRUE, preferDownloaded()); } else updateState(CANCELLED); } @@ -320,7 +324,6 @@ static QString str_error(const char *fmt, ...) void DownloadThread::run() { - DownloadFromDCWidget *dfdcw = DownloadFromDCWidget::instance(); const char *error; if (!strcmp(data->vendor, "Uemis")) @@ -331,8 +334,4 @@ void DownloadThread::run() if (error) { this->error = str_error(error, data->devname, data->vendor, data->product); } - - // I'm not sure if we should really call process_dives even - // if there's an error or a cancelation - process_dives(TRUE, dfdcw->preferDownloaded()); }