Skip to: site menu | section menu | main content

Window.dispose() can be a recursive call

While working on porting Marathon to Java 5, I found a funny problem. We use a TestDialog(derived from JDialog) for running most of the component related test cases. When run under Java 5, the dispose() of TestDialog is being called multiple times. Since TestDialog.dispose() calls super.dispose() this goes into a loop. The number of times TestDialog.dispose() is called is random. I dug into the sources and found that since some developers might not call super.dispose() in classes derived from Window, the VM calls dispose() for them.. So a little bit of sloppy programming would have helped.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>