aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-07-09 22:05:53 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-07-09 22:49:27 +0300
commit24f18983923cc63706e3c5c8a5db6bb073e7afb7 (patch)
tree34ddecba5ab012166720ce3b014364dd3eb86ff8 /bpkg/package.hxx
parentf492f67ced0db166bb9e0840252be616c5be0f67 (diff)
Fix memory leak due to complement repository cycles
Diffstat (limited to 'bpkg/package.hxx')
-rw-r--r--bpkg/package.hxx26
1 files changed, 14 insertions, 12 deletions
diff --git a/bpkg/package.hxx b/bpkg/package.hxx
index ea48045..8c8c661 100644
--- a/bpkg/package.hxx
+++ b/bpkg/package.hxx
@@ -266,16 +266,6 @@ namespace bpkg
class repository_fragment
{
public:
- // We use a weak pointer for prerequisite repositories because we could
- // have cycles. No cycles in complements, thought.
- //
- // Note that these point to repositories, not repository fragments.
- //
- using complements_type =
- std::set<lazy_shared_ptr<repository>, compare_lazy_ptr>;
- using prerequisites_type =
- std::set<lazy_weak_ptr<repository>, compare_lazy_ptr>;
-
// Repository fragment id is a repository canonical name that identifies
// just this fragment (for example, for git it is a canonical name of
// the repository URL with the full, non-abbreviated commit id).
@@ -291,8 +281,20 @@ namespace bpkg
//
repository_location location;
- complements_type complements;
- prerequisites_type prerequisites;
+ // We use a weak pointer for prerequisite repositories because we could
+ // have cycles.
+ //
+ // Note that we could have cycles for complements via the root repository
+ // that is the default complement for dir and git repositories (see
+ // rep-fetch for details), and so we use a weak pointer for complements
+ // either.
+ //
+ // Also note that these point to repositories, not repository fragments.
+ //
+ using dependencies = std::set<lazy_weak_ptr<repository>, compare_lazy_ptr>;
+
+ dependencies complements;
+ dependencies prerequisites;
public:
explicit