forked from qt-creator/qt-creator
ProjectExplorer: reduce amount of concurrent running vcvars.bat scripts
The concurrent execution of multiple batch scripts seems to be suspicious behavior for some of the anti virus solutions out there. Task-number: QTCREATORBUG-20868 Task-number: QTCREATORBUG-20637 Task-number: QTCREATORBUG-20829 Task-number: QTCREATORBUG-20886 Change-Id: I2a05ccf937218bca09227bf34f56da38123ffbe7 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include "msvctoolchain.h"
|
#include "msvctoolchain.h"
|
||||||
|
|
||||||
#include "msvcparser.h"
|
#include "msvcparser.h"
|
||||||
|
#include "projectexplorer.h"
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
#include "taskhub.h"
|
#include "taskhub.h"
|
||||||
#include "toolchainmanager.h"
|
#include "toolchainmanager.h"
|
||||||
@@ -65,6 +66,16 @@ namespace Internal {
|
|||||||
// Helpers:
|
// Helpers:
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static QThreadPool *envModThreadPool()
|
||||||
|
{
|
||||||
|
static QThreadPool *pool = nullptr;
|
||||||
|
if (!pool) {
|
||||||
|
pool = new QThreadPool(ProjectExplorerPlugin::instance());
|
||||||
|
pool->setMaxThreadCount(1);
|
||||||
|
}
|
||||||
|
return pool;
|
||||||
|
}
|
||||||
|
|
||||||
struct MsvcPlatform {
|
struct MsvcPlatform {
|
||||||
MsvcToolChain::Platform platform;
|
MsvcToolChain::Platform platform;
|
||||||
const char *name;
|
const char *name;
|
||||||
@@ -647,7 +658,8 @@ MsvcToolChain::MsvcToolChain(Core::Id typeId, const QString &name, const Abi &ab
|
|||||||
: AbstractMsvcToolChain(typeId, l, d, abi, varsBat)
|
: AbstractMsvcToolChain(typeId, l, d, abi, varsBat)
|
||||||
, m_varsBatArg(varsBatArg)
|
, m_varsBatArg(varsBatArg)
|
||||||
{
|
{
|
||||||
initEnvModWatcher(Utils::runAsync(&MsvcToolChain::environmentModifications,
|
initEnvModWatcher(Utils::runAsync(envModThreadPool(),
|
||||||
|
&MsvcToolChain::environmentModifications,
|
||||||
varsBat, varsBatArg));
|
varsBat, varsBatArg));
|
||||||
|
|
||||||
Q_ASSERT(!name.isEmpty());
|
Q_ASSERT(!name.isEmpty());
|
||||||
@@ -739,7 +751,8 @@ bool MsvcToolChain::fromMap(const QVariantMap &data)
|
|||||||
m_environmentModifications = Utils::EnvironmentItem::itemsFromVariantList(
|
m_environmentModifications = Utils::EnvironmentItem::itemsFromVariantList(
|
||||||
data.value(QLatin1String(environModsKeyC)).toList());
|
data.value(QLatin1String(environModsKeyC)).toList());
|
||||||
|
|
||||||
initEnvModWatcher(Utils::runAsync(&MsvcToolChain::environmentModifications,
|
initEnvModWatcher(Utils::runAsync(envModThreadPool(),
|
||||||
|
&MsvcToolChain::environmentModifications,
|
||||||
m_vcvarsBat, m_varsBatArg));
|
m_vcvarsBat, m_varsBatArg));
|
||||||
|
|
||||||
return !m_vcvarsBat.isEmpty() && m_abi.isValid();
|
return !m_vcvarsBat.isEmpty() && m_abi.isValid();
|
||||||
|
Reference in New Issue
Block a user