forked from j62/ctbrec
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:
parent
764119e20a
commit
fa3512621c
|
@ -644,4 +644,8 @@ public class ThumbCell extends StackPane {
|
|||
return new int[2];
|
||||
}
|
||||
}
|
||||
|
||||
public void releaseResources() {
|
||||
iv.setImage(null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue