Don't call non-const methods on temporary QList

Otherwise it may unnecessarily detach. Either store a local
const reference or call const equivalent (e.g. constFirst()).

Change-Id: I96d665487cf28c17e72bea17f1b8f164ce06cc70
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2022-12-07 19:31:39 +01:00
parent 8e7e1dd5f2
commit c021fb5179
5 changed files with 15 additions and 17 deletions

View File

@@ -268,7 +268,7 @@ void PyLSClient::updateExtraCompilerContents(ExtraCompiler *compiler, const File
void PyLSClient::closeExtraCompiler(ProjectExplorer::ExtraCompiler *compiler)
{
const FilePath file = compiler->targets().first();
const FilePath file = compiler->targets().constFirst();
m_extraCompilerOutputDir.pathAppended(file.fileName()).removeFile();
compiler->disconnect(this);
}