Menu

#7 GraphicsImpl.dispose() needs to tolerate a null ge field

V2.4
open
Internal (1)
5
2004-05-10
2004-05-10
Anonymous
No

If one creates a GraphicsImpl instance and then
manually invokes dispose(), as is the usual convention,
there will be a null pointer exception when the dispose()
method is again called during finalization of the
GraphicsImpl instance.

This is because by this time the ge field is already null.
The fix, of course, is to guard things with a "if (ge !=
null)" check.

Also the protected GraphicsImpl should really be made
public. I am using a mixed approach of using the
graphics enginer directly and then using a GrapicsImpl
instance to draw "diagrams" on the page, and so I need
to share the ge instance.

I am forced to extend the class just to access the
constructor that allows to pass in the ge instance.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB