@@ -56,7 +56,6 @@ QVariantMap makeErrorObject(const QString& errorCode, const QString& errorMessag
5656void interruptThread (QThread* thread)
5757{
5858 qDebug () << " Interrupting thread" << uintptr_t (thread);
59- thread->disconnect ();
6059 thread->requestInterruption ();
6160 ControllerChildThread::waitForControllerNotify.wakeAll ();
6261}
@@ -333,6 +332,8 @@ void Controller::onDialogCancel()
333332{
334333 REQUIRE_NON_NULL (window)
335334
335+ stopCardEventMonitorThread ();
336+
336337 qDebug () << " User cancelled" ;
337338
338339 // Schedule application exit when the UI dialog is destroyed.
@@ -352,8 +353,11 @@ void Controller::onPinPadCancel()
352353
353354void Controller::onCriticalFailure (const QString& error)
354355{
356+ stopCardEventMonitorThread ();
357+
355358 qCritical () << " Exiting due to command" << std::string (commandType ())
356359 << " fatal error:" << error;
360+
357361 _result = makeErrorObject (RESP_TECH_ERROR, error);
358362 writeResponseToStdOut (isInStdinMode, _result, commandType ());
359363 disposeUI ();
@@ -378,6 +382,7 @@ void Controller::waitForChildThreads()
378382 for (const auto & childThread : childThreads) {
379383 auto thread = childThread.second ;
380384 if (thread) {
385+ thread->disconnect ();
381386 interruptThread (thread);
382387 // Waiting for PIN input on PIN pad may take a long time, call processEvents() so that
383388 // the UI doesn't freeze.
0 commit comments