Am Sonntag, den 25.09.2005, 19:30 +0200 schrieb Mark Wielaard:
> Hi Roman,
> 
> On Thu, 2005-09-22 at 16:13 +0200, Roman Kennke wrote:
> > +  /**
> > +   * Performs normal painting without double buffering.
> > +   *
> > +   * @param r the area to be repainted
> > +   */
> > +  void paintSimple(Rectangle r)
> > +  {
> > +    Graphics g = getGraphics();
> > +    Graphics g2 = getComponentGraphics(g);
> > +    paint(g2);
> > +    g2.dispose();
> > +    g2.dispose();
> >    }
> 
> You are disposing g2 twice, but not g.

This is already fixed in one of the followup patches.

> Is there actually a reason to explicitly dispose() of an Graphics
> object? Why don't we just let Graphics.finalize() handle it?

Yeah. 1. I would consider it good style to dispose a Graphics in the
same method where you aquire a Graphics object (don't dispose Graphics
that you get as parameter). 2. The specs seem to implicate that finalize
is not very reliable.

/Roman

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to