[OpenJDK 2D-Dev] Review Reqeust for Bug 100068 - SunGraphics2D exposes a reference to itself while non fully initialised

Mario Torre mario.torre at aicas.com
Mon Jun 15 12:33:01 UTC 2009


Il giorno ven, 12/06/2009 alle 18.41 -0700, Phil Race ha scritto:
> Mario,
> 
> Did you, or can you, share a test case (and any platform specific info 
> needed) to repro this?
> 
> -phil.

Hi Phil!

I think I didn't explained myself very well :)

The purpose of my change is to remove the line of code that initialises
the loops from the constructor:

@@ -254,11 +254,10 @@
         font = f;
         if (font == null) {
             font = defaultFont;
         }
 
-        loops = sd.getRenderLoops(this);
         setDevClip(sd.getBounds());
         invalidatePipe();
     }
 
     protected Object clone() {

The reason I want to do this is to avoid a reference to "this"
to be passed to an external class because SG2D may not be fully initialised,
and I would say that this is at least non nice :)

As for the NPE, I was referring to the fact that just removing the call to
sd.getRenderLoops(this) (which is, again, what I want to do), leaves the loops
uninitialised. This happens in the Java2D demo, for example, because validate
is not called in all the cases as the first thing.

A solution could be to put a check for null in checkFontInfo, like Jim suggested,
because this is called before validate.

I'll prepare a test case for this issue based on the J2D demo,
but of course it's only useful to show the NPE if you remove the
sd.getRenderLoops(this) line from the constructor.

I hope this clarifies a bit my idea.

Cheers,
Mario
-- 
Mario Torre, Software Developer, http://www.jroller.com/neugens/
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-44
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA  FC7C 4086 63E3 80F2 40CF

USt-Id: DE216375633, Handelsregister HRB 109481, AG Mannheim
Geschäftsführer: Dr. James J. Hunt

Please, support open standards:
http://endsoftpatents.org/




More information about the 2d-dev mailing list