From 870bd16f2c64dc8d74056a47bc7845e8d1b3b2f1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Dec 2013 17:37:20 +0100 Subject: [PATCH] QtAutogen: Don't modify target source files while iterating them. Populate a separate vector of files and append them separately. This was the pattern used prior to commit 035b6908 (Autogen: Split AutoRcc handling into two methods, 2013-12-10), which was erroneously not maintained in that refactoring. --- Source/cmQtAutoGenerators.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index a561aabf8..abf20cbb1 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -810,6 +810,8 @@ void cmQtAutoGenerators::InitializeAutoRccTarget(cmTarget* target) const std::vector& srcFiles = target->GetSourceFiles(); + std::vector newFiles; + for(std::vector::const_iterator fileIt = srcFiles.begin(); fileIt != srcFiles.end(); ++fileIt) @@ -833,10 +835,17 @@ void cmQtAutoGenerators::InitializeAutoRccTarget(cmTarget* target) rcc_output_file.c_str(), false); cmSourceFile* rccCppSource = makefile->GetOrCreateSource(rcc_output_file.c_str(), true); - target->AddSourceFile(rccCppSource); + newFiles.push_back(rccCppSource); } } } + + for(std::vector::const_iterator fileIt = newFiles.begin(); + fileIt != newFiles.end(); + ++fileIt) + { + target->AddSourceFile(*fileIt); + } } void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)