forked from j62/ctbrec
1
0
Fork 0

Release resources, if the tab is deselected

This allows the garbage collector to work properly and reduces the
minimum heap size
This commit is contained in:
0xboobface 2020-07-12 12:39:15 +02:00
parent 764119e20a
commit fa3512621c
2 changed files with 13 additions and 0 deletions

View File

@ -644,4 +644,8 @@ public class ThumbCell extends StackPane {
return new int[2];
}
}
public void releaseResources() {
iv.setImage(null);
}
}

View File

@ -872,6 +872,15 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
updateService.cancel();
}
queue.clear();
for (Iterator<Node> iterator = grid.getChildren().iterator(); iterator.hasNext();) {
Node node = iterator.next();
if(node instanceof ThumbCell) {
ThumbCell thumbCell = (ThumbCell) node;
thumbCell.releaseResources();
iterator.remove();
}
}
}
void suspendUpdates(boolean suspend) {