ProjectExplorer: Make DeploymentData::addFile() do what its name says

The check that was done in there was problematic for two reasons:
    - It encoded a policy that a file could not be deployed to more than
      one target path, which might not always be true.
    - It made the function unexpectedly expensive, resulting in
      quadratic behavior for repeated calls. This resulted in noticeable
      UI lag when loading larger projects.
It's the caller's responsibility to prevent duplicates.

Task-number: QTCREATORBUG-18533
Change-Id: I33a328b14f95fe84b3c1041d4b74d645946250bb
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-02-06 16:41:19 +01:00
parent b5710099bb
commit 3894dbfa65

View File

@@ -40,12 +40,6 @@ void DeploymentData::setLocalInstallRoot(const Utils::FilePath &installRoot)
void DeploymentData::addFile(const DeployableFile &file) void DeploymentData::addFile(const DeployableFile &file)
{ {
for (int i = 0; i < m_files.size(); ++i) {
if (m_files.at(i).localFilePath() == file.localFilePath()) {
m_files[i] = file;
return;
}
}
m_files << file; m_files << file;
} }