BUG: Do not double-initialize local generators

All global generator CreateLocalGenerator methods automatically
initialize the local generator instances with SetGlobalGenerator.  In
several places we were calling SetGlobalGenerator again after receiving
the return value from CreateLocalGenerator.  The double-initializations
leaked the resources allocated by the first call to SetGlobalGenerator.
This fix removes the unnecessary calls.
This commit is contained in:
Brad King 2009-07-28 10:47:02 -04:00
parent 57057ee595
commit e9d7ebb3ec
5 changed files with 0 additions and 9 deletions

View File

@ -623,7 +623,6 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
lg->SetGlobalGenerator(&gg);
cmMakefile *mf = lg->GetMakefile();
std::string realInstallDirectory = tempInstallDirectory;
if ( !installSubDirectory.empty() && installSubDirectory != "/" )

View File

@ -335,7 +335,6 @@ void cmCTestScriptHandler::CreateCMake()
this->GlobalGenerator->SetCMakeInstance(this->CMake);
this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator();
this->LocalGenerator->SetGlobalGenerator(this->GlobalGenerator);
this->Makefile = this->LocalGenerator->GetMakefile();
// remove all cmake commands which are not scriptable, since they can't be

View File

@ -1970,7 +1970,6 @@ void cmCTestTestHandler::GetListOfTests()
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
lg->SetGlobalGenerator(&gg);
cmMakefile *mf = lg->GetMakefile();
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str());

View File

@ -350,7 +350,6 @@ int cmCTest::Initialize(const char* binary_dir, bool new_tag,
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
lg->SetGlobalGenerator(&gg);
cmMakefile *mf = lg->GetMakefile();
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )
{

View File

@ -500,7 +500,6 @@ void cmake::ReadListFile(const char *path)
if(path)
{
std::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator());
lg->SetGlobalGenerator(gg);
lg->GetMakefile()->SetHomeOutputDirectory
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
lg->GetMakefile()->SetStartOutputDirectory
@ -1532,7 +1531,6 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
{
cm.SetGlobalGenerator(ggd);
std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
lgd->SetGlobalGenerator(ggd);
lgd->GetMakefile()->SetStartDirectory(startDir.c_str());
lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str());
lgd->GetMakefile()->MakeStartDirectoriesCurrent();
@ -2625,7 +2623,6 @@ int cmake::CheckBuildSystem()
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
lg->SetGlobalGenerator(&gg);
cmMakefile* mf = lg->GetMakefile();
if(!mf->ReadListFile(0, this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
@ -2656,7 +2653,6 @@ int cmake::CheckBuildSystem()
if(ggd.get())
{
std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
lgd->SetGlobalGenerator(ggd.get());
lgd->ClearDependencies(mf, verbose);
}
}
@ -2895,7 +2891,6 @@ void cmake::GenerateGraphViz(const char* fileName) const
cmGlobalGenerator ggi;
ggi.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator());
lg->SetGlobalGenerator(&ggi);
cmMakefile *mf = lg->GetMakefile();
std::string infile = this->GetHomeOutputDirectory();