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.
This commit is contained in:
Brad King 2008-05-27 11:18:01 -04:00
parent 757875df91
commit 1c0ffdc11c
2 changed files with 18 additions and 10 deletions

View File

@ -72,16 +72,7 @@ cmGlobalGenerator::~cmGlobalGenerator()
delete this->ExtraGenerator; delete this->ExtraGenerator;
} }
for (std::map<cmStdString, std::vector<cmTargetExport*> >::iterator this->ClearExportSets();
setIt = this->ExportSets.begin();
setIt != this->ExportSets.end();
++setIt)
{
for (unsigned int i = 0; i < setIt->second.size(); ++i)
{
delete setIt->second[i];
}
}
} }
// Find the make program for the generator, required for try compiles // Find the make program for the generator, required for try compiles
@ -683,6 +674,7 @@ bool cmGlobalGenerator::IsDependedOn(const char* project,
void cmGlobalGenerator::Configure() void cmGlobalGenerator::Configure()
{ {
this->FirstTimeProgress = 0.0f; this->FirstTimeProgress = 0.0f;
this->ClearExportSets();
// Delete any existing cmLocalGenerators // Delete any existing cmLocalGenerators
unsigned int i; unsigned int i;
for (i = 0; i < this->LocalGenerators.size(); ++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<cmStdString, std::vector<cmTargetExport*> >::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<cmTargetExport*>* cmGlobalGenerator::GetExportSet( const std::vector<cmTargetExport*>* cmGlobalGenerator::GetExportSet(
const char* name) const const char* name) const
{ {

View File

@ -293,6 +293,7 @@ protected:
bool InstallTargetEnabled; bool InstallTargetEnabled;
// Sets of named target exports // Sets of named target exports
std::map<cmStdString, std::vector<cmTargetExport*> > ExportSets; std::map<cmStdString, std::vector<cmTargetExport*> > ExportSets;
void ClearExportSets();
// Manifest of all targets that will be built for each configuration. // Manifest of all targets that will be built for each configuration.
// This is computed just before local generators generate. // This is computed just before local generators generate.