From 1e516c4bae1cea8467690e576c40552813f8ed37 Mon Sep 17 00:00:00 2001 From: Dirk Fauth Date: Fri, 8 Aug 2025 13:57:48 +0200 Subject: [PATCH] Fixes #165 - Infinite loop in performance grouping header Signed-off-by: Dirk Fauth --- .../group/performance/ColumnGroupHeaderLayer.java | 13 +++++++++++-- .../group/performance/RowGroupHeaderLayer.java | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayer.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayer.java index b4a076a8..4ac71dfc 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayer.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayer.java @@ -2362,6 +2362,9 @@ public void handleLayerEvent(ILayerEvent event) { ((IStructuralChangeEvent) event).isHorizontalStructureChanged()) { IStructuralChangeEvent changeEvent = (IStructuralChangeEvent) event; Collection columnDiffs = changeEvent.getColumnDiffs(); + + boolean performUpdate = false; + if (columnDiffs != null && !columnDiffs.isEmpty()) { int[] deletedPositions = getDeletedPositions(columnDiffs); @@ -2379,6 +2382,8 @@ public void handleLayerEvent(ILayerEvent event) { } else { handleDeleteDiffs(deletedPositions); } + + performUpdate = true; } for (StructuralDiff diff : columnDiffs) { @@ -2469,11 +2474,15 @@ public void handleLayerEvent(ILayerEvent event) { doCommand(cmd); } } + + performUpdate = true; } } - // update visible start positions of all groups - updateVisibleStartPositions(); + if (performUpdate) { + // update visible start positions of all groups + updateVisibleStartPositions(); + } } else { // trigger a consistency check as the details of the event // probably where removed on converting the layer stack diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayer.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayer.java index 31307e61..593c8096 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayer.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayer.java @@ -2351,6 +2351,9 @@ public void handleLayerEvent(ILayerEvent event) { ((IStructuralChangeEvent) event).isVerticalStructureChanged()) { IStructuralChangeEvent changeEvent = (IStructuralChangeEvent) event; Collection rowDiffs = changeEvent.getRowDiffs(); + + boolean performUpdate = false; + if (rowDiffs != null && !rowDiffs.isEmpty()) { int[] deletedPositions = getDeletedPositions(rowDiffs); @@ -2368,6 +2371,8 @@ public void handleLayerEvent(ILayerEvent event) { } else { handleDeleteDiffs(deletedPositions); } + + performUpdate = true; } for (StructuralDiff diff : rowDiffs) { @@ -2457,12 +2462,16 @@ public void handleLayerEvent(ILayerEvent event) { for (UpdateRowGroupCollapseCommand cmd : collapseUpdates.values()) { doCommand(cmd); } + + performUpdate = true; } } } - // update visible start positions of all groups - updateVisibleStartPositions(); + if (performUpdate) { + // update visible start positions of all groups + updateVisibleStartPositions(); + } } else { // trigger a consistency check as the details of the event // probably where removed on converting the layer stack