Docker: Set future after connecting

Fixes a "QFutureWatcher::connect: connecting after calling setFuture()
is likely to produce race".

Amends 2a7bf0fdaf.

Change-Id: I69391984e2e583491bb978e41812b4f5a4c7b1a6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2025-02-18 09:26:46 +01:00
parent 28dbc1cf0a
commit 8a15dae077

View File

@@ -602,7 +602,6 @@ DockerDevice::DockerDevice()
auto future = DockerApi::instance()->networks();
auto watcher = new QFutureWatcher<expected_str<QList<Network>>>(this);
watcher->setFuture(future);
QObject::connect(watcher,
&QFutureWatcher<expected_str<QList<Network>>>::finished,
this,
@@ -622,6 +621,7 @@ DockerDevice::DockerDevice()
cb({errorItem});
}
});
watcher->setFuture(future);
});
connect(DockerApi::instance(),