Browse Source

ctest_update: Fix crash when handling svn externals

Refactoring in commit v3.9.0-rc1~156^2 (c++: prefer vectors over lists,
2017-05-04) switched `cmCTestSVN::Repositories` from `std::list` to
`std::vector`.  This can cause re-allocation when svn externals are
processed and break the `RootInfo` pointer that is supposed to point at
the first repository element.  Switch back to `std::list` so that the
address remains stable.

Fixes: #17854
Brad King 7 years ago
parent
commit
27f033550a
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Source/CTest/cmCTestSVN.h

+ 3 - 1
Source/CTest/cmCTestSVN.h

@@ -8,6 +8,7 @@
 #include "cmCTestGlobalVC.h"
 
 #include <iosfwd>
+#include <list>
 #include <string>
 #include <vector>
 
@@ -70,7 +71,8 @@ private:
   friend struct Revision;
 
   // Info of all the repositories (root, externals and nested ones).
-  std::vector<SVNInfo> Repositories;
+  // Use std::list so the elements don't move in memory.
+  std::list<SVNInfo> Repositories;
 
   // Pointer to the infos of the root repository.
   SVNInfo* RootInfo;