From 23ebdbb5ebcd261d86dc8ba18e6bf0b9b57cf345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 14 Aug 2024 17:11:56 +0200 Subject: [PATCH 1/2] Hide Table_removeIndex() from extern callers Table_removeIndex() needs to be called with care, e.g. Vector_compact() needs to be called afterwards. Do no call by accident from external code. --- Table.c | 2 +- Table.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Table.c b/Table.c index 79bd43245..42aab427b 100644 --- a/Table.c +++ b/Table.c @@ -69,7 +69,7 @@ void Table_add(Table* this, Row* row) { // removing items. // Note: for processes should only be called from ProcessTable_iterate to avoid // breaking dying process highlighting. -void Table_removeIndex(Table* this, const Row* row, int idx) { +static void Table_removeIndex(Table* this, const Row* row, int idx) { int rowid = row->id; assert(row == (Row*)Vector_get(this->rows, idx)); diff --git a/Table.h b/Table.h index fa85fd660..79ea70ca0 100644 --- a/Table.h +++ b/Table.h @@ -68,8 +68,6 @@ void Table_printHeader(const Settings* settings, RichString* header); void Table_add(Table* this, struct Row_* row); -void Table_removeIndex(Table* this, const struct Row_* row, int idx); - void Table_updateDisplayList(Table* this); void Table_expandTree(Table* this); From be4719d5670feb6c2d8e4bfa00d6678a55e745d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 14 Aug 2024 17:15:12 +0200 Subject: [PATCH 2/2] Force rebuild of display table after removals Table_compact() is called after Table_cleanupRow(), which might remove rows, which are still referenced by the display table. Set needsSort to true so that Table_updateDisplayList() always performs a rebuild and does access removed rows. Fixes: #1517 --- Table.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Table.h b/Table.h index 79ea70ca0..d1bf25af3 100644 --- a/Table.h +++ b/Table.h @@ -88,6 +88,7 @@ void Table_cleanupRow(Table* this, Row* row, int idx); static inline void Table_compact(Table* this) { Vector_compact(this->rows); + this->needsSort = true; } #endif