From da97d2625aeb9cad57657ed9cc076b558f30921d Mon Sep 17 00:00:00 2001 From: Denis Lisov Date: Fri, 20 May 2022 23:57:36 +0300 Subject: [PATCH] ProcessList_collapseAllBranches: actually build tree As the loop checks `tree_depth`, a tree build is needed to ensure they're filled in correctly. Note that this breaks the display list sort order in case it's non-tree-based (either startup in flat mode, or `*` hotkey in flat mode), so the display list will need to be sorted again. --- ProcessList.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ProcessList.c b/ProcessList.c index f71619f6..2fad32b7 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -353,7 +353,10 @@ void ProcessList_expandTree(ProcessList* this) { } } +// Called on collapse-all toggle and on startup, possibly in non-tree mode void ProcessList_collapseAllBranches(ProcessList* this) { + ProcessList_buildTree(this); // Update `tree_depth` fields of the processes + this->needsSort = true; // ProcessList is sorted by parent now, force new sort int size = Vector_size(this->processes); for (int i = 0; i < size; i++) { Process* process = (Process*) Vector_get(this->processes, i);