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

Jim Graham Jim.A.Graham at Sun.COM
Thu Jun 18 19:52:46 UTC 2009

That makes a lot of sense since I think the introduction of the 
GlyphListLoopPipe in its current form was where the original methodology 
of "always install loops if you plan to use loops" was first (and only 
time) violated.

I think I raised the issue at the time and Phil pointed out that, in 
practice, the loops never really change for a given surface type (as in, 
if a different compositing mode is set or if a non-color paint is set 
then we use entirely different mechanisms to render so the only loops 
that exist for these are "solid color" loops and those loops are always 
valid for all cases that use these pipes).

While that may mean we don't have a practical bug yet, the weakness of 
that argument in general, and the desire to resolve the issue from the 
original bug report may mean we should revisit this practice.

One solution would be to always set the loops for the validations that 
install one of these pipes.  That could have potential performance 
impact, but it would be no worse than the validation sequences that 
already set the loops every time so I don't think it would be serious, 
or even measurable.

Another solution could involve splitting these loops out into a separate 
structure that can be set once in the lifetime of an SG2D and then 
reused as appropriate.  But this is banking on the "only one version of 
these loops really exists anyway" constraint and some day that 
constraint is likely to disappear and then we really will need to pick 
new loops on every validate.

As such, I think I'd prefer the first solution - to just pick new loops 
every time they are needed (i.e. unless the pipeline really doesn't use 
the loops directly, or indirectly through these text pipes)...


Mario Torre wrote:
> Il giorno gio, 18/06/2009 alle 00.34 +0200, Mario Torre ha scritto:
>> But I'll debafterug it a little further and send you some updates asap.
>> Cheers,
>> Mario
> Hello!
> The pipelines that use a loops after being invalidated without checking
> if it's valid or not (null) are those so far:
> LCDTextRenderer
> GlyphListLoopPipe
> AATextRenderer
> Those all are subclasses of GlyphListLoopPipe.
> The LCDTextRenderer never fails if I don't explicitly set to null the
> loops in invalidatePipe, same happens for instances of GlyphListLoopPipe
> which don't fail immediately as when I set the loops to null, so I think
> some of those calls use loops there were initialised somehow from
> validatePipe in some previous call to this method, but that should not
> be valid anymore.
> There are no other places where I get NPE, but I've tested only with the
> Java2D demo so far.
> Cheers,
> Mario

More information about the 2d-dev mailing list