free mainpanel on reload (it is not disposed by java GC for some reason)

This commit is contained in:
honfika@gmail.com
2015-05-25 16:16:55 +02:00
parent 134fd1558a
commit dc28ce5da7
4 changed files with 35 additions and 11 deletions

View File

@@ -786,20 +786,24 @@ public class Helper {
f.setAccessible(true);
Object v = f.get(obj);
if (v != null) {
if (v instanceof Collection) {
((Collection) v).clear();
}
if (v instanceof Component) {
if (((Component) v).getParent() != null) {
((Component) v).getParent().remove((Component) v);
try {
if (v instanceof Collection) {
((Collection) v).clear();
}
}
if (v instanceof Freed) {
Freed freed = ((Freed) v);
if (!freed.isFreeing()) {
((Freed) v).free();
if (v instanceof Component) {
if (((Component) v).getParent() != null) {
((Component) v).getParent().remove((Component) v);
}
}
if (v instanceof Freed) {
Freed freed = ((Freed) v);
if (!freed.isFreeing()) {
((Freed) v).free();
}
}
} catch (Throwable t) {
}
f.set(obj, null);
}
} catch (UnsupportedOperationException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {