diff --git a/logic/JavaChecker.cpp b/logic/JavaChecker.cpp index 113974ff..a470bfa2 100644 --- a/logic/JavaChecker.cpp +++ b/logic/JavaChecker.cpp @@ -47,6 +47,7 @@ void JavaChecker::finished(int exitcode, QProcess::ExitStatus status) JavaCheckResult result; { result.path = path; + result.id = id; } if (status == QProcess::CrashExit || exitcode == 1) @@ -104,6 +105,7 @@ void JavaChecker::error(QProcess::ProcessError err) JavaCheckResult result; { result.path = path; + result.id = id; } emit checkFinished(result); diff --git a/logic/JavaChecker.h b/logic/JavaChecker.h index 291bf46c..4705381c 100644 --- a/logic/JavaChecker.h +++ b/logic/JavaChecker.h @@ -15,6 +15,7 @@ struct JavaCheckResult QString javaVersion; bool valid = false; bool is_64bit = false; + int id; }; typedef std::shared_ptr QProcessPtr; @@ -27,6 +28,7 @@ public: void performCheck(); QString path; + int id; signals: void checkFinished(JavaCheckResult result); diff --git a/logic/JavaCheckerJob.cpp b/logic/JavaCheckerJob.cpp index 36a8a050..bb39bf62 100644 --- a/logic/JavaCheckerJob.cpp +++ b/logic/JavaCheckerJob.cpp @@ -26,10 +26,8 @@ void JavaCheckerJob::partFinished(JavaCheckResult result) << javacheckers.size(); emit progress(num_finished, javacheckers.size()); - javaresults.append(result); - int result_size = javacheckers.size(); - - emit progress(num_finished, result_size); + QLOG_INFO() << "after replace" << result.id << javaresults.size(); + javaresults.replace(result.id, result); if (num_finished == javacheckers.size()) { @@ -43,6 +41,7 @@ void JavaCheckerJob::start() m_running = true; for (auto iter : javacheckers) { + javaresults.append(JavaCheckResult()); connect(iter.get(), SIGNAL(checkFinished(JavaCheckResult)), SLOT(partFinished(JavaCheckResult))); iter->performCheck(); } diff --git a/logic/lists/JavaVersionList.cpp b/logic/lists/JavaVersionList.cpp index e8c5acd0..eb1c5650 100644 --- a/logic/lists/JavaVersionList.cpp +++ b/logic/lists/JavaVersionList.cpp @@ -182,13 +182,17 @@ void JavaListLoadTask::executeTask() connect(m_job.get(), SIGNAL(progress(int, int)), this, SLOT(checkerProgress(int, int))); QLOG_DEBUG() << "Probing the following Java paths: "; + int id = 0; for(QString candidate : candidate_paths) { QLOG_DEBUG() << " " << candidate; auto candidate_checker = new JavaChecker(); candidate_checker->path = candidate; + candidate_checker->id = id; m_job->addJavaCheckerAction(JavaCheckerPtr(candidate_checker)); + + id++; } m_job->start();