diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2017-10-31 21:28:59 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-31 16:32:08 -0700 |
commit | 3acc28cebf9d3ebaa48c564f87c0eb85ed43b74c (patch) | |
tree | f4cce6cb29b0a89b754293a44cae31f9f4fb8efe /desktop-widgets/downloadfromdivecomputer.cpp | |
parent | 945a0a87482dc24c5f12cdaaf1b3576549a4c8a5 (diff) | |
download | subsurface-3acc28cebf9d3ebaa48c564f87c0eb85ed43b74c.tar.gz |
Postpone error message display if not in GUI thread
Calls to report_error() crashed if not called from GUI thread.
Fix this by postponing error message display if not in GUI thread.
Code that creates a thread which possibly calls report_error()
is responsible for calling MainWindow::showErrors() to flush
the accumulated messages.
Note that there is a race condition in report_error() and
get_error_string(). Nevertheless, hitting it should be rather
unlikely (two threads producing error messages at the same time)
and hopefully it can be fixed rather easily.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/downloadfromdivecomputer.cpp')
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index 637f6034d..b875b4a76 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -220,6 +220,10 @@ void DownloadFromDCWidget::updateState(states state) // got an error else if (state == ERROR) { timer->stop(); + + // Show messages that worker thread produced. + MainWindow::instance()->showErrors(); + QMessageBox::critical(this, TITLE_OR_TEXT(tr("Error"), thread.error), QMessageBox::Ok); markChildrenAsEnabled(); progress_bar_text = ""; |