RemoteLinux: Fix crash

When adding a Docker device via the Add Device Wizard,
while the docker executable is running on a remote linux device,
a crash would happen because the linux device is destroyed
due to a call to "saveSettings".

This patch adds a lock to the device shell mutex during destruction
to try and keep the device alive while a LinuxDevicePrivate::runInShell
call is still ongoing.

Fixes: QTCREATORBUG-31364
Change-Id: Ia154b527bb8344fc41fa91a56a7ef3305bfef0fa
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-08-01 07:33:06 +02:00
parent fb18e5e992
commit c7aae25b94

View File

@@ -1170,6 +1170,7 @@ LinuxDevicePrivate::LinuxDevicePrivate(LinuxDevice *parent)
LinuxDevicePrivate::~LinuxDevicePrivate()
{
QMutexLocker locker(&m_shellMutex);
auto closeShell = [this] {
m_shellThread.quit();
m_shellThread.wait();