Просмотр исходного кода

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.
Brad King 17 лет назад
Родитель
Сommit
1c0ffdc11c
2 измененных файлов с 18 добавлено и 10 удалено
  1. 17 10
      Source/cmGlobalGenerator.cxx
  2. 1 0
      Source/cmGlobalGenerator.h

+ 17 - 10
Source/cmGlobalGenerator.cxx

@@ -72,16 +72,7 @@ cmGlobalGenerator::~cmGlobalGenerator()
     delete this->ExtraGenerator;
     }
 
-  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->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<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 char* name) const
 {

+ 1 - 0
Source/cmGlobalGenerator.h

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