AppletLoader: clean up resources (images) when switching to the LWJGL Applet as opposed to when applet is destroyed
This commit is contained in:
parent
3656b80763
commit
a7b892b7ab
|
@ -368,12 +368,19 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
||||||
if (lwjglApplet != null) {
|
if (lwjglApplet != null) {
|
||||||
lwjglApplet.destroy();
|
lwjglApplet.destroy();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up resources
|
||||||
|
*/
|
||||||
|
protected void cleanUp() {
|
||||||
progressbar = null;
|
progressbar = null;
|
||||||
logo = null;
|
logo = null;
|
||||||
|
|
||||||
logoBuffer = null;
|
logoBuffer = null;
|
||||||
progressbarBuffer = null;
|
progressbarBuffer = null;
|
||||||
|
|
||||||
|
offscreen = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -501,6 +508,9 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
||||||
*/
|
*/
|
||||||
public boolean imageUpdate(Image img, int flag, int x, int y, int width, int height) {
|
public boolean imageUpdate(Image img, int flag, int x, int y, int width, int height) {
|
||||||
|
|
||||||
|
// finish with this ImageObserver
|
||||||
|
if (state == STATE_DONE) return false;
|
||||||
|
|
||||||
// if image frame is ready to be drawn and is currently not being painted
|
// if image frame is ready to be drawn and is currently not being painted
|
||||||
if (flag == ImageObserver.FRAMEBITS && !painting) {
|
if (flag == ImageObserver.FRAMEBITS && !painting) {
|
||||||
Image buffer;
|
Image buffer;
|
||||||
|
@ -751,6 +761,8 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
||||||
switchApplet();
|
switchApplet();
|
||||||
|
|
||||||
state = STATE_DONE;
|
state = STATE_DONE;
|
||||||
|
// clean up resources
|
||||||
|
cleanUp();
|
||||||
} catch (AccessControlException ace) {
|
} catch (AccessControlException ace) {
|
||||||
fatalErrorOccured(ace.getMessage(), ace);
|
fatalErrorOccured(ace.getMessage(), ace);
|
||||||
certificateRefused = true;
|
certificateRefused = true;
|
||||||
|
|
Loading…
Reference in New Issue