Hi,
this is a small patch to the FlipBufferStrategy class which lives inside
Component. I do not fully understand how it should work and how the
implementation is supposed to work and therefore simply fixed the apparent
issue: When someone requests a real (# of buffers > 1) back buffer strategy the
drawVBuffer field is not initialized and NPEs are thrown on access.

I prevented these exceptions and implemented getGraphics in a way that actual
painting will be visible.

Comments?

No ChangeLog so far as I am waiting for input from others.

cya
Robert
Index: java/awt/Component.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.120
diff -u -r1.120 Component.java
--- java/awt/Component.java	4 Jun 2006 20:21:39 -0000	1.120
+++ java/awt/Component.java	6 Jun 2006 08:07:43 -0000
@@ -6332,7 +6332,7 @@
      */
     public Graphics getDrawGraphics()
     {
-      return drawVBuffer.getGraphics();
+      return (drawVBuffer != null) ? drawVBuffer.getGraphics() : peer.getGraphics();
     }
 
     /**
@@ -6357,7 +6357,7 @@
      */
     public boolean contentsLost()
     {
-      if (drawVBuffer.contentsLost())
+      if (drawVBuffer != null && drawVBuffer.contentsLost())
 	{
 	  validatedContents = false;
 	  return true;

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to