|
From: <ka...@us...> - 2010-07-24 20:01:04
|
Revision: 3386
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3386&view=rev
Author: kappa1
Date: 2010-07-24 20:00:58 +0000 (Sat, 24 Jul 2010)
Log Message:
-----------
AppletLoader: clean up resources (images) when switching to the LWJGL Applet as opposed to when applet is destroyed
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2010-07-21 18:53:41 UTC (rev 3385)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2010-07-24 20:00:58 UTC (rev 3386)
@@ -368,12 +368,19 @@
if (lwjglApplet != null) {
lwjglApplet.destroy();
}
-
+ }
+
+ /**
+ * Clean up resources
+ */
+ protected void cleanUp() {
progressbar = null;
logo = null;
logoBuffer = null;
progressbarBuffer = null;
+
+ offscreen = null;
}
/**
@@ -501,6 +508,9 @@
*/
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 (flag == ImageObserver.FRAMEBITS && !painting) {
Image buffer;
@@ -750,7 +760,9 @@
// switch to LWJGL Applet
switchApplet();
- state = STATE_DONE;
+ state = STATE_DONE;
+ // clean up resources
+ cleanUp();
} catch (AccessControlException ace) {
fatalErrorOccured(ace.getMessage(), ace);
certificateRefused = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|