-
Notifications
You must be signed in to change notification settings - Fork 30
Cleanup thread cleaning and fix PinPAD crash #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
a6f2233
to
2911ccf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, very nice simplification of the thread management 👍 !
3f0e6c7
to
d9aa4d1
Compare
ba65333
to
893a5ad
Compare
085c22a
to
6f6b023
Compare
Fixes #346 Signed-off-by: Raul Metsma <raul@metsma.ee>
ControllerChildThread::waitForControllerNotify.wakeAll(); | ||
while (thread->isRunning()) { | ||
using namespace std::chrono_literals; | ||
thread->wait(100ms); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 100 millisecond wait made only sense along with event processing, recommend to add it back:
thread->wait(100ms); | |
thread->wait(100ms); | |
QCoreApplication::processEvents(); |
Otherwise the while loop does not have a purpose, it is equivalent to just waiting indefinitely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All calls waitForChildThreads() are after disposeUI, no point to process any more events.
and timer makes sure that function does not continue before all thread are ended
void Controller::onDialogCancel() | ||
{ | ||
REQUIRE_NON_NULL(window) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you emit stopCardEventMonitorThread()
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see that there can be any running thread at this point
{ | ||
static MockUI instance; | ||
return &instance; | ||
return new MockUI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This leaks, no parent nor WA_DeleteOnClose
. Should you add WA_DeleteOnClose
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think it will ever shown and cosed. Right now there is double free crash
Fixes #346
Signed-off-by: Raul Metsma raul@metsma.ee