We need to dispose of the graphics that we obtain from getDrawGraphics().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2536 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-05-02 23:54:56 +00:00
parent 2d0897ed4b
commit 352b3d3d6d
@@ -1,5 +1,5 @@
// //
// $Id: FlipFrameManager.java,v 1.2 2003/05/01 22:06:52 mdb Exp $ // $Id: FlipFrameManager.java,v 1.3 2003/05/02 23:54:56 mdb Exp $
package com.threerings.media; package com.threerings.media;
@@ -35,11 +35,15 @@ public class FlipFrameManager extends FrameManager
boolean incremental = true; boolean incremental = true;
do { do {
Graphics2D gfx = (Graphics2D)_bufstrat.getDrawGraphics(); Graphics2D gfx = null;
try {
gfx = (Graphics2D)_bufstrat.getDrawGraphics();
// dirty everything if we're not incrementally rendering // dirty everything if we're not incrementally rendering
if (!incremental) { if (!incremental) {
Log.info("Doing non-incremental render; contents lost."); Log.info("Doing non-incremental render; contents lost " +
"[lost=" + _bufstrat.contentsLost() +
", rest=" + _bufstrat.contentsRestored() + "].");
_frame.getRootPane().revalidate(); _frame.getRootPane().revalidate();
_frame.getRootPane().repaint(); _frame.getRootPane().repaint();
} }
@@ -57,6 +61,11 @@ public class FlipFrameManager extends FrameManager
// everything // everything
incremental = false; incremental = false;
} finally {
if (gfx != null) {
gfx.dispose();
}
}
} while (_bufstrat.contentsLost()); } while (_bufstrat.contentsLost());
} }