diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2021-05-12 16:55:32 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2021-05-12 22:09:03 +0000 |
commit | da27ac457f524bc96788228461e62e1ef2eaaab7 (patch) | |
tree | f49040fa034a3bc02cf675ca9294575a91adea66 /src/plugins/python | |
parent | 91f136ef3ab75471cabcaed9dc16dad9f504add8 (diff) |
Do QFutureWatcher::setFuture() after connecting to watcher's signals
Otherwise we may have race condition.
Reference: documentation for QFutureWatcher::setFuture()
and the implementation of
QFutureInterfaceBasePrivate::connectOutputInterface(
QFutureCallOutInterface *interface).
Change-Id: I5b483baaf1b844871a162f47ce7683e9ff495acb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/python')
-rw-r--r-- | src/plugins/python/pythonutils.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp index 7854935ff82..309bb873f69 100644 --- a/src/plugins/python/pythonutils.cpp +++ b/src/plugins/python/pythonutils.cpp @@ -381,7 +381,6 @@ void PyLSConfigureAssistant::openDocumentWithPython(const FilePath &python, using CheckPylsWatcher = QFutureWatcher<PythonLanguageServerState>; QPointer<CheckPylsWatcher> watcher = new CheckPylsWatcher(); - watcher->setFuture(Utils::runAsync(&checkPythonLanguageServer, python)); // cancel and delete watcher after a 10 second timeout QTimer::singleShot(10000, this, [watcher]() { @@ -401,6 +400,7 @@ void PyLSConfigureAssistant::openDocumentWithPython(const FilePath &python, handlePyLSState(python, watcher->result(), document); watcher->deleteLater(); }); + watcher->setFuture(Utils::runAsync(&checkPythonLanguageServer, python)); } void PyLSConfigureAssistant::handlePyLSState(const FilePath &python, |