From 1c0ffdc11c20376b5a353634e63bfcb0fafc1cc0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 27 May 2008 11:18:01 -0400 Subject: BUG: Fix crash on repeated configure steps and exported targets. - In cmGlobalGenerator the ExportSets ivar must be cleared at the beginning of each Configure. - See issue #7101. --- Source/cmGlobalGenerator.cxx | 27 +++++++++++++++++---------- Source/cmGlobalGenerator.h | 1 + 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index dce60ff..33a7f20 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -72,16 +72,7 @@ cmGlobalGenerator::~cmGlobalGenerator() delete this->ExtraGenerator; } - for (std::map >::iterator - setIt = this->ExportSets.begin(); - setIt != this->ExportSets.end(); - ++setIt) - { - for (unsigned int i = 0; i < setIt->second.size(); ++i) - { - delete setIt->second[i]; - } - } + this->ClearExportSets(); } // Find the make program for the generator, required for try compiles @@ -683,6 +674,7 @@ bool cmGlobalGenerator::IsDependedOn(const char* project, void cmGlobalGenerator::Configure() { this->FirstTimeProgress = 0.0f; + this->ClearExportSets(); // Delete any existing cmLocalGenerators unsigned int i; for (i = 0; i < this->LocalGenerators.size(); ++i) @@ -1232,6 +1224,21 @@ void cmGlobalGenerator::AddTargetToExports(const char* exportSetName, } } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::ClearExportSets() +{ + for(std::map >::iterator + setIt = this->ExportSets.begin(); + setIt != this->ExportSets.end(); ++setIt) + { + for(unsigned int i = 0; i < setIt->second.size(); ++i) + { + delete setIt->second[i]; + } + } + this->ExportSets.clear(); +} + const std::vector* cmGlobalGenerator::GetExportSet( const char* name) const { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7991a33..519158f 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -293,6 +293,7 @@ protected: bool InstallTargetEnabled; // Sets of named target exports std::map > ExportSets; + void ClearExportSets(); // Manifest of all targets that will be built for each configuration. // This is computed just before local generators generate. -- cgit v0.12