From 451567c31dd4f4968792f6f38a685118300cb0be Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 23 Feb 2018 15:35:35 +0100 Subject: [PATCH] Msvc: Check if future was canceled before accessing the result Change-Id: I3029d665f64dd144e1e4010f0856537e7fb218f1 Reviewed-by: Christian Stenger --- src/plugins/projectexplorer/msvctoolchain.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 15248a3b737..75a0a931f63 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -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()); }