aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package-configuration.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-06-09 15:40:44 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2022-06-09 17:12:30 +0200
commit5dc97e2eeb5f2c3173f0227ef8d0d64e10cbc9cd (patch)
tree9ddab4c1bbde009b3815682fb634ca207c32bd17 /bpkg/package-configuration.cxx
parent1b5dd9ce731f07147c998b46b5079b87e8674e30 (diff)
Fix crashing in up_negotiate_configuration()
Diffstat (limited to 'bpkg/package-configuration.cxx')
-rw-r--r--bpkg/package-configuration.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/bpkg/package-configuration.cxx b/bpkg/package-configuration.cxx
index 6ec2ea3..624de18 100644
--- a/bpkg/package-configuration.cxx
+++ b/bpkg/package-configuration.cxx
@@ -130,10 +130,15 @@ namespace bpkg
if (da.prefer || cfg.empty ())
depc.reload_defaults (cfg);
-
- depc_cfgs.push_back (cfg);
}
+ // Note that we need to collect the dependency configurations as a
+ // separate loop so that the stored references are not invalidated by
+ // operator[] (which is really a push_back() into a vector).
+ //
+ for (package_skeleton& depc: depcs)
+ depc_cfgs.push_back (cfgs[depc.key]);
+
// Step 2: execute the prefer/accept or requires clauses.
//
if (!(da.require