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.
This commit is contained in:
Denis Lisov 2022-05-20 23:57:36 +03:00
parent d73cc70566
commit da97d2625a

View File

@ -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) { 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); int size = Vector_size(this->processes);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
Process* process = (Process*) Vector_get(this->processes, i); Process* process = (Process*) Vector_get(this->processes, i);