docker: Correctly initialize Kit during autodetection

* Added returning the Id after detecting CMake so it can be set in the autodetected kit
* Trying to keep autodetect from adding the same Qt installation twice if qmake is linked in /bin and /usr/bin
* Added FIXME for RunControlPrivate::runConfiguration as it is used after free in rare cases
* Fixed IosCompilerDetector to not just run if a device is set
* Fixed QnxCompilerDetector to not just run if a device is set
* Fixed auto-detected debuggers not being set as auto-detected, as they now can be removed from the device screen

Change-Id: Ia7772c454d70e147e4326efacc4a6a888fa26782
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marcus Tillmanns
2022-04-07 14:04:20 +02:00
parent aa3f467ee2
commit 2c4553366c
13 changed files with 113 additions and 54 deletions

View File

@@ -74,21 +74,31 @@ bool DockerApi::canConnect()
return result;
}
void DockerApi::checkCanConnect()
void DockerApi::checkCanConnect(bool async)
{
std::unique_lock lk(m_daemonCheckGuard, std::try_to_lock);
if (!lk.owns_lock())
return;
if (async) {
std::unique_lock lk(m_daemonCheckGuard, std::try_to_lock);
if (!lk.owns_lock())
return;
m_dockerDaemonAvailable = nullopt;
dockerDaemonAvailableChanged();
auto future = Utils::runAsync([lk = std::move(lk), this] {
m_dockerDaemonAvailable = canConnect();
m_dockerDaemonAvailable = nullopt;
dockerDaemonAvailableChanged();
});
Core::ProgressManager::addTask(future, tr("Checking docker daemon"), "DockerPlugin");
auto future = Utils::runAsync([lk = std::move(lk), this] {
m_dockerDaemonAvailable = canConnect();
dockerDaemonAvailableChanged();
});
Core::ProgressManager::addTask(future, tr("Checking docker daemon"), "DockerPlugin");
return;
}
std::unique_lock lk(m_daemonCheckGuard);
bool isAvailable = canConnect();
if (!m_dockerDaemonAvailable.has_value() || isAvailable != m_dockerDaemonAvailable) {
m_dockerDaemonAvailable = isAvailable;
dockerDaemonAvailableChanged();
}
}
void DockerApi::recheckDockerDaemon()
@@ -97,17 +107,17 @@ void DockerApi::recheckDockerDaemon()
s_instance->checkCanConnect();
}
Utils::optional<bool> DockerApi::dockerDaemonAvailable()
Utils::optional<bool> DockerApi::dockerDaemonAvailable(bool async)
{
if (!m_dockerDaemonAvailable.has_value())
checkCanConnect();
checkCanConnect(async);
return m_dockerDaemonAvailable;
}
Utils::optional<bool> DockerApi::isDockerDaemonAvailable()
Utils::optional<bool> DockerApi::isDockerDaemonAvailable(bool async)
{
QTC_ASSERT(s_instance, return nullopt);
return s_instance->dockerDaemonAvailable();
return s_instance->dockerDaemonAvailable(async);
}
FilePath DockerApi::findDockerClient()