Postpone error message display if not in GUI thread#753
Merged
dirkhh merged 1 commit intosubsurface:masterfrom Oct 31, 2017
Merged
Postpone error message display if not in GUI thread#753dirkhh merged 1 commit intosubsurface:masterfrom
dirkhh merged 1 commit intosubsurface:masterfrom
Conversation
neolit123
requested changes
Oct 31, 2017
Member
neolit123
left a comment
There was a problem hiding this comment.
thanks for this,
the patch looks good to me, but i haven't tested it.
a small coding style request bellow.
desktop-widgets/mainwindow.cpp
Outdated
| // If we're not in the GUI thread, let errors accumulate. | ||
| if (QThread::currentThread() != QCoreApplication::instance()->thread()) { | ||
| return; | ||
| } |
Member
There was a problem hiding this comment.
can you please remove all braces { } if the if statement wraps a single line.
becomes:
if (QThread::currentThread() != QCoreApplication::instance()->thread())
return;
applies to the rest of the patch too.
Member
There was a problem hiding this comment.
NOTE: i know that we have this in a lot of places, but the idea is to keep future if additions consistent.
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>
Collaborator
Author
|
Done - still works with my (simple) test case. |
Member
|
thanks - LGTM. |
neolit123
approved these changes
Oct 31, 2017
Collaborator
|
This is simple and hopefully deal with the biggest problem in my code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Describe the pull request:
Pull request long description:
Changes made:
Related issues:
Additional information:
Mentions: