Msvc: Check if future was canceled before accessing the result

Change-Id: I3029d665f64dd144e1e4010f0856537e7fb218f1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2018-02-23 15:35:35 +01:00
committed by Christian Stenger
parent 4aced20a21
commit 451567c31d

View File

@@ -570,7 +570,7 @@ Utils::Environment MsvcToolChain::readEnvironmentSetting(const Utils::Environmen
{
if (m_environmentModifications.isEmpty()) {
m_envModWatcher.waitForFinished();
if (m_envModWatcher.future().isFinished())
if (m_envModWatcher.future().isFinished() && !m_envModWatcher.future().isCanceled())
m_environmentModifications = m_envModWatcher.result();
}
Utils::Environment result = env;
@@ -593,8 +593,12 @@ MsvcToolChain::MsvcToolChain(const MsvcToolChain &other)
, m_environmentModifications(other.m_environmentModifications)
, m_varsBatArg(other.m_varsBatArg)
{
if (!other.m_envModWatcher.isRunning())
if (other.m_envModWatcher.isRunning()) {
initEnvModWatcher(other.m_envModWatcher.future());
} else if (m_environmentModifications.isEmpty() && other.m_envModWatcher.future().isFinished()
&& !other.m_envModWatcher.future().isCanceled()) {
m_environmentModifications = other.m_envModWatcher.result();
}
setDisplayName(other.displayName());
}