Skip to content

Commit 3a5fa69

Browse files
committed
fix occasional issue with cell reuse when avoiding updating cells during table size estimation
1 parent 4774830 commit 3a5fa69

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected void updateItem(Entry entry, boolean empty) {
5757
super.updateItem(entry, empty);
5858

5959
//Return immediately to avoid CPU usage when updating the same invisible cell to determine tableview size (see https://bugs.openjdk.org/browse/JDK-8280442)
60-
if(this == lastCell && !getTableRow().isVisible()) {
60+
if(this == lastCell && !getTableRow().isVisible() && isTableSizeRecalculation()) {
6161
return;
6262
}
6363
lastCell = this;
@@ -856,4 +856,11 @@ public static void applyRowStyles(TreeTableCell<?, ?> cell, Entry entry) {
856856
}
857857
}
858858
}
859+
860+
private boolean isTableSizeRecalculation() {
861+
//As per https://bugs.openjdk.org/browse/JDK-8265669 we check for cell visibility to avoid unnecessary recalculation, but this can result in false positives
862+
//The method releaseCell in VirtualFlow is responsible for setting accumCell visibility to false after use, so check this method is calling updateItem
863+
return StackWalker.getInstance().walk(frames -> frames.anyMatch(frame -> frame.getClassName().equals("javafx.scene.control.skin.VirtualFlow")
864+
&& frame.getMethodName().equals("releaseCell")));
865+
}
859866
}

0 commit comments

Comments
 (0)