* Memory handling - some more changes to improve object deallocation.

This commit is contained in:
LevelX2 2014-02-06 18:00:45 +01:00
parent 2427b714a1
commit df9c200753
8 changed files with 51 additions and 22 deletions

View file

@ -164,7 +164,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
* Free all references
*
*/
public void clear() {
public void cleanUp() {
this.cardGrid.clear();
this.mainModel.clear();
}

View file

@ -60,9 +60,9 @@ public class DeckArea extends javax.swing.JPanel {
sideboardList.setDisplayNoCopies(true);
}
public void clear() {
deckList.clear();
sideboardList.clear();
public void cleanUp() {
deckList.cleanUp();
sideboardList.cleanUp();
}
public void showSideboard(boolean show) {

View file

@ -61,6 +61,7 @@ import mage.client.constants.Constants.DeckEditorMode;
import mage.client.constants.Constants.SortBy;
import mage.client.dialog.AddLandDialog;
import mage.client.dialog.PreferencesDialog;
import mage.client.plugins.MagePlugins;
import mage.client.plugins.adapters.MageActionCallback;
import mage.client.plugins.impl.Plugins;
import mage.client.util.Event;
@ -123,7 +124,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
}
/**
* Free resources so GC can work
* Free resources so GC can remove unused objects from memory
*/
public void cleanUp() {
if (updateDeckTask != null) {
@ -137,9 +138,10 @@ public class DeckEditorPanel extends javax.swing.JPanel {
countdown.removeActionListener(al);
}
}
this.cardSelector.clear();
this.deckArea.clear();
this.getUI().uninstallUI(this);
this.cardSelector.cleanUp();
this.deckArea.cleanUp();
this.remove(bigCard);
this.bigCard = null;
((MageActionCallback) Plugins.getInstance().getActionCallback()).setCardPreviewComponent(null);
}

View file

@ -71,6 +71,11 @@ public final class CollectionViewerPanel extends JPanel {
}
}
public void cleanUp() {
this.hidePopup();
this.bigCard = null;
}
public void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel1.setOpaque(false);
@ -210,8 +215,7 @@ public final class CollectionViewerPanel extends JPanel {
}
public void removeCollectionViewer() {
hidePopup();
this.cleanUp();
Component c = this.getParent();
while (c != null && !(c instanceof CollectionViewerPane)) {
c = c.getParent();