File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -244,12 +244,8 @@ bool Checkable::AffectsChildren() const
244244std::set<Checkable::Ptr> Checkable::GetParents () const
245245{
246246 std::set<Checkable::Ptr> parents;
247-
248- for (const Dependency::Ptr& dep : GetDependencies ()) {
249- Checkable::Ptr parent = dep->GetParent ();
250-
251- if (parent && parent.get () != this )
252- parents.insert (parent);
247+ for (auto & dependencyGroup : GetDependencyGroups ()) {
248+ dependencyGroup->LoadParents (parents);
253249 }
254250
255251 return parents;
Original file line number Diff line number Diff line change @@ -153,6 +153,20 @@ std::vector<Dependency::Ptr> DependencyGroup::GetMembers(const Checkable* child)
153153 return members;
154154}
155155
156+ /* *
157+ * Load all parent Checkables of the current dependency group members.
158+ *
159+ * @param parents The set to load the parent Checkables into.
160+ */
161+ void DependencyGroup::LoadParents (std::set<Checkable::Ptr>& parents) const
162+ {
163+ std::lock_guard lock (m_Mutex);
164+ for (auto & [_, dependencies] : m_Members) {
165+ VERIFY (!dependencies.empty ()); // We should never have an empty map for any given key at any given time.
166+ parents.insert (dependencies.begin ()->second ->GetParent ());
167+ }
168+ }
169+
156170/* *
157171 * Retrieve the number of members in the current dependency group.
158172 *
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ class DependencyGroup final : public SharedObject
152152 void AddMember (const Dependency::Ptr& member);
153153 void RemoveMember (const Dependency::Ptr& member);
154154 std::vector<Dependency::Ptr> GetMembers (const Checkable* child) const ;
155+ void LoadParents (std::set<Checkable::Ptr>& parents) const ;
155156 size_t GetMemberCount () const ;
156157
157158 void SetIcingaDBIdentifier (const String& identifier);
You can’t perform that action at this time.
0 commit comments