From 0fb635e76c294b37caebdbd081a44de7c0dc094d Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Tue, 28 Mar 2023 10:27:00 +0200 Subject: [PATCH] Docker: Fix Shell destruction handling Change-Id: I125ac2eaf99e8dff85da06640f048b502f36fa08 Reviewed-by: hjk Reviewed-by: --- src/plugins/docker/dockerdevice.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 5c543dfc3a8..f1b650268e5 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -528,7 +528,14 @@ void DockerDevicePrivate::stopCurrentContainer() if (!DockerApi::isDockerDaemonAvailable(false).value_or(false)) return; - m_shell.reset(); + if (m_shell) { + // We have to disconnect the shell from the device, otherwise it will try to + // tell us about the container being stopped. Since that signal is emitted in a different + // thread, it would be delayed received by us when we might already have started + // a new shell. + m_shell->disconnect(this); + m_shell.reset(); + } QtcProcess proc; proc.setCommand({m_settings->dockerBinaryPath.filePath(), {"container", "stop", m_container}});