From ee6d4cdbce4bcef64c97af1bf5e66382ca25c087 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Wed, 17 Jan 2018 19:55:13 +0000 Subject: [PATCH] Leave out children already shown in ancestor node --- GUI/MainModInfo.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/GUI/MainModInfo.cs b/GUI/MainModInfo.cs index 7f692e6b72..e63e0b3ff8 100644 --- a/GUI/MainModInfo.cs +++ b/GUI/MainModInfo.cs @@ -184,6 +184,22 @@ private void BeforeExpand(object sender, TreeViewCancelEventArgs args) Cursor.Current = prevCur; } + private bool ImMyOwnGrandpa(TreeNode node) + { + CkanModule module = node.Tag as CkanModule; + if (module != null) + { + for (TreeNode other = node.Parent; other != null; other = other.Parent) + { + if (module == other.Tag) + { + return true; + } + } + } + return false; + } + private void UpdateModDependencyGraph(CkanModule module) { ModInfoTabControl.Tag = module ?? ModInfoTabControl.Tag; @@ -224,6 +240,10 @@ private void _UpdateModDependencyGraph() private void AddChildren(IRegistryQuerier registry, TreeNode node) { + // Skip children of nodes from circular dependencies + if (ImMyOwnGrandpa(node)) + return; + // Load one layer of grandchildren on demand CkanModule module = node.Tag as CkanModule; // Tag is null for non-indexed nodes